I tried deleting an item from a table with AJAX via a POST call.
///// DELETE INDIVIDUAL ROW IN A TABLE /////
jQuery('.stdtable .delete').live('click', function (e) {
//var newsId1 = $(this).attr("title");
e.preventDefault();
var p = jQuery(this).parents('tr');
if (p.next().hasClass('togglerow'))
p.next().remove();
p.fadeOut(function () {
jQuery(this).remove();
});
$.ajax({
URL: "/AdminPanel/News/DeleteNews",
data: { "newsId": 1 },
dataType: "json",
type: "POST",
success: function (msg) {
alert(msg);
}
});
In this code I get Uncaught TypeError: Cannot read property 'ajax' of undefined.
Best Answer
Did you try doing what the rest of the code is doing, using
jQuery
You can wrap your code in a DOM ready function that sets the value of
$
locally in the function scope, that way you can always use$