Elv*_*dov 5 ajax jquery post json
我尝试通过POST调用从AJAX中删除一个项目.
///// 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);
}
});
Run Code Online (Sandbox Code Playgroud)
在这段代码中,我得到了Uncaught TypeError:无法读取未定义的属性'ajax'.
ade*_*neo 20
您是否尝试过使用其他代码正在执行的操作 jQuery
jQuery.ajax({
URL: "/AdminPanel/News/DeleteNews",
data: { "newsId": 1 },
dataType: "json",
type: "POST",
success: function (msg) {
alert(msg);
}
Run Code Online (Sandbox Code Playgroud)
您可以将代码包装在DOM ready函数中,$该函数在函数范围内设置local值,这是您可以随时使用的方式$
jQuery(function($) {
// code goes here
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
44468 次 |
| 最近记录: |