Php jquery ajax post请求中出现错误,该请求不';我什么都不退
我使用jquery ajax调用,以便能够在php中设置会话值,因此我有一个jquery代码:Php jquery ajax post请求中出现错误,该请求不';我什么都不退,php,jquery,ajax,Php,Jquery,Ajax,我使用jquery ajax调用,以便能够在php中设置会话值,因此我有一个jquery代码: $j(document).ready(function() { var $id = null; $j(".calendar_list a").click(function(){ $id = $j(this).attr("id"); $j.ajax({ type: 'POST',
$j(document).ready(function() {
var $id = null;
$j(".calendar_list a").click(function(){
$id = $j(this).attr("id");
$j.ajax({
type: 'POST',
url: "http://www2.salone-studente.it/wordpress/wp-content/themes/salonestudente-young/backend.php",
data: {img: $id},
dataType: "json",
success: function(response) {},
error: function(xhr, type, exception) { alert("Error: " + type); }
});
});
});
并且backend.php的内容是
<?php
session_start();
$_SESSION['id'] = $_POST['img'];
?>
它在除firefox之外的所有浏览器中都运行良好,在firebug中,我看到在控制台中,我看到一条红色的“类似错误”的线,带有:
职位
如果我查看内部,我会看到所有正确的参数,但显然没有响应。如果后端脚本内容实际上只是您发布的内容,那么Firebug中不会有任何输出,因为您没有在PHP文件中回显任何内容是的,我不希望返回任何内容,我只想将会话变量设置为在其他页面中使用它,但在firefox和chrome中并非如此。我发现问题出在ajax调用中,但我找不到它。有什么帮助吗?