Figured out a way to do this so wanted to update with what I found. This basically cancels the initial request and creates a new one with all the same values except what you override in the extend function. By doing this, any callback functions, etc, are kept. In addition, I put in an 'if' statement because I only wanted to change certain requests based on the url.
$.ajaxSetup({ beforeSend : function() { if([want to change request]) { $.ajax($.extend(this,{ type:"POST", data: { field1:[some value] }, url:[new url] } )); return false; }; } }); vtjiles wrote: > > > I have an app and want to change the url for all ajax requests to give > them a relative path. I tried to set up a global change using > ajaxSetup and beforeSend, but the url was only updated in the config, > not the request object. Any thoughts on how to do this? > > <code> > $.ajaxSetup({ > beforeSend : function(J) { > this.url = "/newpath/" + this.url; > } > }); > </code> > > -- View this message in context: http://www.nabble.com/Change-URL-in-beforeSend-tp20979635s27240p21752039.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.