我正面临ajax调用的问题。未找到Ajax 404错误
这是我LIMK这里我使用Ajax调用http://www.cholokhai.com/resturant/test-demo/
我在页脚文件包含的脚本
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
和Ajax调用的代码是:
jQuery("#next_button").click(function(e){
jQuery(".fetch_data").hide();
jQuery(".booking_confirm").show();
var selected_date = jQuery("#selected_date").text();
var selected_persons = jQuery("#selected_persons").text();
var selected_discount = jQuery("#discount_time").text();
var selected_price = jQuery("#discount_price").text();
var filled_name = jQuery("#selected_name").val();
var filled_email = jQuery("#selected_email").val();
var filled_phone = jQuery("#selected_phone").val();
var postData = 'name='+filled_name+'&email='+filled_email+'&phone='+filled_phone+'&date='+selected_date+'&persons='+selected_persons+'&time='+selected_discount+'&discount='+selected_price;
jQuery.ajax({
url : "http://www.cholokhai.com/ajax",
type: "POST",
data : {v:postData},
dataType: 'json',
success: function(html)
{
jQuery(".booking_confirm").show();
}
});
return false;
});
当即时通讯使用变量不是字符串的数据,如:data {name:filled_name,email:filled_email} 即时通讯404错误。
我不知道为什么它不工作。 请帮我解决这个问题。 谢谢。
你做错了。不要以这种方式包含jQuery。它会造成各种问题。使用正确的方法。在这里看到我的答案如何做到这一点:http://stackoverflow.com/questions/34321767/wordpress-inline-js-cant-get-working/34322445#34322445 –
'404错误'意味着''url'是错误的.. –
404表示未找到页面。如果http://www.cholokhai.com是您应用程序的基础网址,则应该使用:url:“/ ajax” – DinoMyte