在过去的一个小时里,我一直在阅读有关XMLHttpRequest的文章,但我似乎可以让它工作起来。因此,我在另一个服务器/端口上有一个django服务器和一个JavaScript客户机,当我尝试执行jquery post时,我得到一个
XMLHttpRequest cannot load http://127.0.0.1:8000/api/smart/rating/. Origin http://localhost is not allowed by Access-Control-Allow-Origin.
我在客户端收到Xmlthhprequest错误消息
Django代码:
class R
请考虑以下代码:
$.ajax({
url: "http://x.com/api/AnnouncementCategory/Save",
type: "Post",
success: function (data) {
//Grab our data from Ground Control
alert(data);
},
error: function (event) {
我正尝试使用jquery/post访问和API,但它在IE8中不起作用。它仅在IE8中抛出拒绝访问错误。
js代码:
var url = 'http://somecomp.cartodb.com:80/api/v1/map?map_key=xxxxxxxxxxxxxxxxxxxx&stat_tag=API';
var data = //some long data of length greater than 3000
$.ajax({
crossOrigin: !0,
type: "POST",
当我从本地主机8080向外部API发起POST请求时,我正面临频繁的405问题。我尝试了很多不同的选择,但我没有得到问题的关键。
URL = api end point; //Your URL
var datajson = '{'
+'"image" : "'+imageBase64+'"'
+'}';
var req = new XMLHttpRequest();
var body = JSON.parse(datajson)
if ('withCrede
$.ajax({
type : 'POST', // define the type of HTTP verb we want to use (POST for our form)
url : 'https://your_url.aspx', // the url where we want to POST
data : school, // our data object
dataType : 'json', // what typ
对Service的JQuery AJAX调用将抛出异常,作为“拒绝访问”。见截图。它在SOAP中工作,因此SOAP请求似乎是正确的。请帮助发现问题和修复。
我的另一个代码截图-
<!DOCTYPE html>
<html>
<head>
<title>Calling Web Service from jQuery</title>
<script type="text/javascript" src="jquery-1.9.1.js"></script>