$http({
method: "POST",
url: 'http://192.168.3.140:8081/SamplengcordovaApp/Savedata.php',
data: resdata,
dataType: "json"
})
.success(function (data, status, headers, config) {
debugger;
alert(data);
})
.error(function (data, status, headers, config) {
alert(status);
});
getting the success but not saved in database.please provide the supported code for me.
This is basically a Cross-origin resource sharing (CORS) problem.
You are making an ajax request from a page of different domain. which is not allowed.
To allow it you will have to append Access-Control-Allow-Origin
in the response header of the server page by adding this on the top of the server page
header('Access-Control-Allow-Origin: *');
Note: the '*' at the end means it will accept any request from any website, for added security you could do this
header('Access-Control-Allow-Origin: http://yourwebsite.com');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.