[英]Can't get in the getJSON function()
I have getJSON code like this:我有这样的 getJSON 代码:
$('#selected_article').change(function(){
$.getJSON('<?php echo $_SERVER['SCRIPT_NAME']; ?>', {
ajax: 'ajax_article_partlist' ,
parent_article: $('#selected_article').val()
},
function(data) {
console.log(data);
});
});
I can't get the function(data)
.我无法获得function(data)
。 The console.log
won't trigger an alert. console.log
不会触发警报。 On the PHP side I get stuff that I need;在 PHP 方面,我得到了我需要的东西; I can see it in the error_log
, and I tried with print
and also echo
.我可以在error_log
看到它,我尝试使用print
和echo
。
In developer tools, see network tab.在开发人员工具中,请参阅网络选项卡。 Once you run your ajax request - it should appear there.一旦你运行你的 ajax 请求 - 它应该出现在那里。 You can view what is returned.您可以查看返回的内容。 Looks like your response is not a valid JSON and that is why success calback is not called.看起来您的响应不是有效的 JSON,这就是不调用成功回调的原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.