转换卷曲AJAX请求
问题描述:
我需要转换下面卷曲请求,AJAX,转换卷曲AJAX请求
CURL : $ curl -X POST http://textbelt.com/text -d number=5551234567 -d "message=I sent this message for free with textbelt.com"
我写的AJAX请求低于:
$.ajax({
type: 'post',
url: "http://textbelt.com/text",
data: "number=+1********** message='This is a test message!",
success:function(response)
{
console.log("Success!!");
},
error : function(xhr, status, error)
{
console.log("Status of error message" + status + "Error is" + error);
}
});
我从一开始的反应服务器是:
{
"success": false,
"message": "Number and message parameters are required."
}
任何人都可以请指导我在正确的方向吗?
答
$.ajax({
type: 'post',
url: "http://textbelt.com/text",
data: {"number":"+1**********", "message":"This is a test message!"},
success:function(response)
{
console.log("Success!!");
},
error : function(xhr, status, error)
{
console.log("Status of error message" + status + "Error is" + error);
}
});
以上应该工作。
感谢您的回答!有用 :) –