在zen购物车中执行jquery ajax发布时出现500内部服务器错误

时间:2012-06-08 20:38:33

标签: php jquery ajax zen-cart

嗨我正在使用zen购物车并拥有此代码,我不断收到500内部服务器错误,我不确定它是否是我的PHP脚本中的代码或东西都是:

<?php
global $db

$partNum = trim(strtolower($_POST['partNum']));
$partNum = mysql_escape_string($partNum);

$query = "SELECT products_model FROM " . TABLE_PRODUCTS . " WHERE products_model = '$partNum' LIMIT 1";
$result = $db->Execute($query);
$num = mysql_num_rows($result);

echo $num;
mysql_close();

和jquery

jQuery.ajax({
   type: "POST",
   url: "/includes/templates/theme376/phpScripts/check.php",
   data: 'partNum='+ partNum,
   cache: false,
   success: function(response){
if(response == 1){
$('#partNum').css('border', '3px #C33 solid');  
$('#tick').hide();
$('#cross').fadeIn();
}else{
$('#partNum').css('border', '3px #090 solid');
$('#cross').hide();
$('#tick').fadeIn();
     }

}
});

这是错误

POST http://mysite.com/includes/templates/theme376/phpScripts/check.php?partNum=wwww 500 (Internal Server Error) /min/?f=/includes/templates/theme376/jscript/jscript_fileuploader.js,/includes/templates/theme376/jscript/jscript_jquery-1.7.1.min.js,/includes/templates/theme376/jscript/jscript_jquery-ui-1.8.20.custom.min.js,/includes/templates/theme376/jscript/jscript_jquery.nivo.slider.pack.js&1332216833:38
f.support.ajax.f.ajaxTransport.send /min/?f=/includes/templates/theme376/jscript/jscript_fileuploader.js,/includes/templates/theme376/jscript/jscript_jquery-1.7.1.min.js,/includes/templates/theme376/jscript/jscript_jquery-ui-1.8.20.custom.min.js,/includes/templates/theme376/jscript/jscript_jquery.nivo.slider.pack.js&1332216833:38
f.extend.ajax /min/?f=/includes/templates/theme376/jscript/jscript_fileuploader.js,/includes/templates/theme376/jscript/jscript_jquery-1.7.1.min.js,/includes/templates/theme376/jscript/jscript_jquery-ui-1.8.20.custom.min.js,/includes/templates/theme376/jscript/jscript_jquery.nivo.slider.pack.js&1332216833:38
partNum_check index.php:307
f.event.dispatch /min/?f=/includes/templates/theme376/jscript/jscript_fileuploader.js,/includes/templates/theme376/jscript/jscript_jquery-1.7.1.min.js,/includes/templates/theme376/jscript/jscript_jquery-ui-1.8.20.custom.min.js,/includes/templates/theme376/jscript/jscript_jquery.nivo.slider.pack.js&1332216833:37
f.event.add.h.handle.i

1 个答案:

答案 0 :(得分:0)

从数据中取出partnum并将其用作查询字符串。

您刚刚收到通用500错误?没有细节?

如果您在请求网址中添加?partnum = blah会怎样?

我不确定你想要“数据”中的查询参数。这意味着数据,而不是查询字符串。