简体   繁体   中英

How to test an AJAX application that is pulling data from a live website?

I'm working on an AJAX application that pulls data from a live website, I can't replicate the complete application on my local environment at the moment so in order to test if the JavaScript code is working as expected I need to be able to bypass the same domain restriction on the browser (without making changes on the webserver) any suggestion will be greatly appreciated.

So far I have tried modifying the prefs.js in Firefox 2 and Camino including the lines suggested in this link: http://www.zachleat.com/web/2007/08/30/cross-domain-xhr-with-firefox/

Thanks in advance.

Edit 04/29/2009 3:18pm:

I agree the proxy option is definitely a way to go. But would it be possible to have a solution using just Firefox? (maybe an add-on?)

If you can change the endpoint URL you could bounce the requests through your local server, either with mod_rewrite or a simple script.

This has the advantage that you can easily log the requests and responses, and alter them (eg send back timeout errors, bad data and the like).

好吧,要查看请求/单步执行 js,请尝试使用Firebug

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM