我在预跳中遇到ajax响应问题。
我用方法编写了模块
廉价产品.php
public function GetData(){
if(Tools::getValue('method')) echo "asdasd";
echo "string";
}
和在main.js 中
jQuery(document).ready(function(){
$('#cheaper form').submit(function(){
var url = $("#cheaper .url").val();
var email = $("#cheaper .email").val();
$.ajax({
url: baseDir+'modules/cheaperproduct/cheaperproduct.php',
method:"post",
data:'method=GetData',
success: function(data){
alert(data);
}
})
return false;
})
})
我有空警报。
我检查了很多方法来解决我的问题,但没有人帮我
有人能解释一下怎么了吗?
try this:
public function GetData(){
if(Tools::getValue('method')) die(json_encode('ciao'));;
echo "method not found!";
}