[英]Cross domain ajax request does not send response
I am trying to validate the PAN card detail. 我正在尝试验证PAN卡的详细信息。 http://searchpan.in/search-pan-details-pan-no by using the ajax call i am trying to validate the pan card entered by user.
通过使用ajax调用http://searchpan.in/search-pan-details-pan-no ,我正在尝试验证用户输入的Pan Card。 I am sending pan number to this url using ajax call http://searchpan.in/pan-verify-26072017.php
我正在使用ajax调用http://searchpan.in/pan-verify-26072017.php将平移号发送到此URL
function callbackFnc(data) {
console.log(data)
}
function check() {
$.ajax({
crossOrigin: true,
type: "Post",
data: {
pan_numbers: $("#pannumber").val()
},
url: "http://searchpan.in/pan-verify-26072017.php",
dataType: 'JSONP',
headers: {
'Accept': "application/json, text/javascript, */*; q=0.01",
'Content-Type': "application/x-www-form-urlencoded; charset=UTF-8",
'X-Requested-With': "XMLHttpRequest"
},
jsonpCallback: 'callbackFnc',
success: function (data) {
alert(data);
}
});
<form id="" method="post"action="verify.php">
Pan Number<input name="number" id="pannumber">
<input type="button" onclick="check()"value='verify'>
</form>
I have checked and all the relevant question and applied the given solution but not getting the response. 我已经检查了所有相关问题,并应用了给定的解决方案,但没有得到答复。 Is this a correct way to do ?
这是正确的方法吗? or please let me know how could we do,to get the response from http://searchpan.in/pan-verify-26072017.php
或请让我知道我们该怎么做,以获取http://searchpan.in/pan-verify-26072017.php的回复
在pan-verify-26072017.php的 <?php
之后设置以下行,这应该可以工作
header('Access-Control-Allow-Origin: *');
try this simple ajax 试试这个简单的ajax
var pan_number = $("#pannumber").val();
$.ajax({
type: 'POST',
url: "http://searchpan.in/pan-verify-26072017.php",
data: {'pannumber': pan_number},
success: function (data) {
alert(data);
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.