如何使用jquery调用3方api? [英] How to call 3 party api using jquery ?
问题描述
任何人都可以帮助我吗?
我尝试过:
函数SaveCustomer(){
var CustomerData = {
display_name:sridhar cotton mills,
first_name:Benjamin,
last_name:George,
电子邮件: benjamin.george@bowmanfurniture.com,
company_name:鲍曼家具,
手机:23467278,
手机:938237475 ,
网站:www.bowmanfurniture.com,
billing_address:{
street:Harrington Bay Street,>
城市:盐湖城,
州:CA,
邮编:92612,
国家:美国,
传真: 4527389
},
shipping_address:{
street:Micheal Street,
city: Austin,
州:Texas,
zip:75211,
国家:美国,
传真:4527389
},
currency_code:USD,
ach_supported:true,
笔记:Bowman Furniture,
custom_fields:[
{
index:1,
值:129890
},
{
index:2,
值:高级
}
]
};
$ .ajax({
类型:POST,
url :https://subscriptions.zoho.com/api/v1/customers?authtoken=a4bc301e5ba3b3fbc93c4ba8459f06ea&organization_id=630550294,
//标题:{'授权':'Zoho-authtoken d18cb257b4439ea1bd77095b87c962c4' ,
//'X-com-zoho-subscriptions-organizationid':'558109392'
//},
// beforeSend: setHeader,
data:JSON.stringify(CustomerData),
contentType:application / json; charset = utf-8,
dataType:jsonp,
processData:true,
crossDomain:true,
成功:函数(数据,状态,jqXHR){
alert(JSON.stringify(CustomerData));
alert(success ...+ status );
},
错误:ServiceFailed
});
}
Hi ,
Anyone can help me ?
What I have tried:
function SaveCustomer() {
var CustomerData = {
display_name: "sridhar cotton mills",
first_name: "Benjamin",
last_name: "George",
email: "benjamin.george@bowmanfurniture.com",
company_name: "Bowman Furniture",
phone: "23467278",
mobile: "938237475",
website: "www.bowmanfurniture.com",
billing_address: {
street: "Harrington Bay Street",
city: "Salt Lake City",
state: "CA",
zip: "92612",
country: "U.S.A",
fax: "4527389"
},
shipping_address: {
street: "Micheal Street",
city: "Austin",
state: "Texas",
zip: "75211",
country: "U.S.A",
fax: "4527389"
},
currency_code: "USD",
ach_supported: true,
notes: "Bowman Furniture",
custom_fields: [
{
"index": 1,
"value": "129890"
},
{
"index": 2,
"value": "Premium"
}
]
};
$.ajax({
type: "POST",
url: "https://subscriptions.zoho.com/api/v1/customers?authtoken=a4bc301e5ba3b3fbc93c4ba8459f06ea&organization_id=630550294",
// headers: { 'Authorization': 'Zoho-authtoken d18cb257b4439ea1bd77095b87c962c4',
// 'X-com-zoho-subscriptions-organizationid': '558109392'
// },
// beforeSend: setHeader,
data: JSON.stringify(CustomerData),
contentType: "application/json; charset=utf-8",
dataType: "jsonp",
processData: true,
crossDomain: true,
success: function (data, status, jqXHR) {
alert(JSON.stringify(CustomerData));
alert("success..." + status);
},
error: ServiceFailed
});
}
推荐答案
.ajax({
类型:POST,
url:https://subscriptions.zoho.com/api / v1 / customers?authtoken = a4bc301e5ba3b3fbc93c4ba8459f06ea& organization_id = 630550294,
// headers:{'Authorization':'Zoho-authtoken d18cb257b4439ea1bd77095b87c962c4',
//'X -com-zoho-subscriptions-organizationid':'558109392'
//},
// beforeSend:setHeader,
data:JSON.stringify(CustomerData),
contentType:application / json; charset = utf-8,
dataType:jsonp,
processData:true,
crossDomain:true,
成功:函数(数据,状态,jqXHR){
alert(JSON.stringify(CustomerData));
alert(success ...+ status );
},
错误:ServiceFailed
});
}
.ajax({
type: "POST",
url: "https://subscriptions.zoho.com/api/v1/customers?authtoken=a4bc301e5ba3b3fbc93c4ba8459f06ea&organization_id=630550294",
// headers: { 'Authorization': 'Zoho-authtoken d18cb257b4439ea1bd77095b87c962c4',
// 'X-com-zoho-subscriptions-organizationid': '558109392'
// },
// beforeSend: setHeader,
data: JSON.stringify(CustomerData),
contentType: "application/json; charset=utf-8",
dataType: "jsonp",
processData: true,
crossDomain: true,
success: function (data, status, jqXHR) {
alert(JSON.stringify(CustomerData));
alert("success..." + status);
},
error: ServiceFailed
});
}
这篇关于如何使用jquery调用3方api?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!