Uncaught TypeError: Cannot read property 'ajax' of undefined

后端 未结 2 942
傲寒
傲寒 2021-02-20 18:49

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\', funct         


        
2条回答
  •  梦毁少年i
    2021-02-20 19:18

    Did you try doing what the rest of the code is doing, using jQuery

    jQuery.ajax({
      URL: "/AdminPanel/News/DeleteNews",
      data: { "newsId": 1 },
      dataType: "json",
      type: "POST",
      success: function (msg) {
      alert(msg);
    }
    

    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 $

    jQuery(function($) {
        // code goes here
    });
    

提交回复
热议问题