I have problem with ajax response in prestahop.
I wrote module with method
cheaperproduct.php
public function GetData(){
if(Tools::getValue('method')) echo "asdasd";
echo "string";
}
and in 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;
})
})
And I have empty alert.
I checked many ways to resolve my problem, but no one help me.
Can somebody explain me what's wrong?