HTML, СОДЕРЖАЩИЙСЯ В METABOX:
Код: Выделить всё
[url=#]Delete Item[/url]
Код: Выделить всё
function blah(theid){
if ( confirm("Are you sure you wish to remove this image (Note: Images are not removed from the Media Library)?") ) {
var data = {
action: 'myajax-delete',
imgid: theid
};
jQuery.post(ajaxurl, data, function(response) {
//Parse the JSON Object
var object = jQuery.parseJSON(response);
if ( response.status == 'true' )
{
jQuery('#file_' + theid + '_row').remove(); //remove TR
alert('Image removed from this portfolio');
}else{
alert('Sorry, that image could not removed right now, please reload the page and try again.');
}
});
Если я использую следующую строку кода ниже, AJAX работает (поэтому я знаю, что с JS все в порядке), но мне нужно иметь возможность вызывать функцию по имени, а не использовать селектор. Мне очень хочется понять, почему я не могу вызвать простую функцию!!!!
Код: Выделить всё
jQuery('.delete_pimg').click(function() { ^Above code^ }
Надеюсь, я объяснил это ясно. Если нет, пожалуйста, дайте мне знать
Подробнее здесь: https://stackoverflow.com/questions/798 ... ot-defined
Мобильная версия