在jQuery中,使用ajaxSend预览$ .post调用构建的URL [英] In jQuery, using ajaxSend to preview the url built by $.post call
问题描述
我该如何构建我的ajaxSend调用(这似乎是放置它的地方),以预览传递回给代理的内容?另外,我可以在ajaxSend中停止ajax调用吗?..以便在处理来自代理的错误之前可以完善我的url字符串?
How can I construct my ajaxSend call, this seems like the place to put it, to preview what is being passed back to the broker? also, can I stop the ajax call in ajaxSend?..so I can perfect my url string before dealing with errors from the broker?
这是完整的URL,当传递给代理时,它将返回我需要的JSON代码:
This is the complete URL that, when passed to the broker, will return the JSON code I need:
http://myServer/cgi-bin/broker?service=myService&program=myProgram§ion=mySection&start=09/08/08&end=09/26/08
这是我的$ .post调用(不确定是否正在创建上面的url字符串)
This is my $.post call (not sure it is creating the above url string)
$(function() {
$("#submit").bind("click",
function() {
$.post({
url: "http://csewebprod/cgi-bin/broker" ,
datatype: "json",
data: {
'service' : myService,
'program' : myProgram,
'section' : mySection,
'start' : '09/08/08',
'end' : '09/26/08'
},
error: function(request){
$("#updateHTML").removeClass("hide") ;
$("#updateHTML").html(request.statusText);
},
success: function(request) {
$("#updateHTML").removeClass("hide") ;
$("#updateHTML").html(request) ;
}
}); // End post method
}); // End bind method
}); // End eventlistener
谢谢
推荐答案
预览发送的HTTP请求的一种简单方法是使用 Firefox的Firebug .下载并启用该插件,并在发出请求后将其显示在Firebug控制台中.
An easy way to preview the HTTP request being sent is to use Firebug for Firefox. Download and enable the plugin, and when the request is made it will show up in the firebug console.
这篇关于在jQuery中,使用ajaxSend预览$ .post调用构建的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!