gpt4 book ai didi

jquery - Django jquery ajax 403错误

转载 作者:行者123 更新时间:2023-12-03 22:29:21 26 4
gpt4 key购买 nike

我正在尝试让 ajax 工作,但我不断收到 403 错误。我对 jquery 还很陌生。

以下是我的代码

    $('#prod_search_button').click(function(){
if ($('#inv_prod_list').length) {
//insert a new record
}
else
{
//create the #inv_prod_list table and insert first record
var inv_table= '<table id="inv_prod_list" style="border: 2px solid #dddddd;"></table>';

// create query object
var prod_query = {
query: jQuery.trim($('#id_prod_query').val())
};

// convert object to JSON data
var jsonQuery = JSON.stringify(prod_query);

$.ajax({
type: 'POST',
url: '/company/product/item_search.json/',
data: jsonQuery,

success: function(jsonData){
var parsed = JSON.parse(jsonData);
$('#inv_prod_wrap').html(inv_table);

var new_record = 'this is html for new row'

$('#inv_prod_list tr:last').after(new_record);



//off rows alt color
}
});
}
});

最佳答案

关于jquery - Django jquery ajax 403错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7646781/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com