使用ajax在服务器上调用脚本的jquery语法
我们正在使用jquery表单插件()对服务器进行jquery ajax post调用。一旦我们得到回应 我们需要对此进行解析,并在服务器上再进行一次ajax调用。请让我知道使用jquery调用它的语法使用ajax在服务器上调用脚本的jquery语法,jquery,html,ajax,forms,Jquery,Html,Ajax,Forms,我们正在使用jquery表单插件()对服务器进行jquery ajax post调用。一旦我们得到回应 我们需要对此进行解析,并在服务器上再进行一次ajax调用。请让我知道使用jquery调用它的语法 $('#MyForm').ajaxForm({ success: function(data) { console.log("My form submit successful.The response is >>" + data); // Process this
$('#MyForm').ajaxForm({
success: function(data) {
console.log("My form submit successful.The response is >>" + data);
// Process this response and call another script on the server.
}
});
从回调函数中发出ajax请求如下所示:没有什么特别的,也没有什么不寻常的
$('#MyForm').ajaxForm({
success: function(data) {
console.log("My form submit successful.The response is >>" + data);
// Process this response and call another script on the server.
$.ajax({
method: "GET", /*string "GET" or "POST"*/
data: {}, /* query string or object with properties to pass to the server */
url: "url.com", /* url of the next script */
success: function () {/* success callback code */},
});
}
});
在成功函数中添加另一个ajax调用,如下所示:
$('#MyForm').ajaxForm({
success: function(data) {
console.log("My form submit successful.The response is >>" + data);
// Process this response and call another script on the server.
$.ajax({
url: 'http://yourURL',
data: {
var: 'val',
..
},
type: 'POST', //GET
datatype: 'text', //XML,JSON
success: function(result) {
//result data handling
}
error: functionn() {
//error handling
}
});
}
});
这是正确的。你目前面临的问题是什么!
数据
看起来像什么(JSON、HTML、blob…)?第二个ajax调用需要什么,它的类型是什么(POST,GET)?数据是json,第二个ajax也返回json。这是电话。