I have the following Ajax call:
function ajaxCall(soap, url){
// Post SOAP request.
$.ajax({
type: "POST",
url: url,
contentType: "text/xml",
data: soap,
dataType: "xml",
processData: false,
beforeSend: passToProxy(url),
success: onSuccess,
error: function(){
getRandom();
}
});
}
function passToProxy(xhr,url1) {
alert(url1);
// Pass the target URL onto the proxy.
xhr.setRequestHeader("SOAPTarget","http://localhost:8088/mockSDClientSOAPBinding");
// Pass the action onto the proxy.
xhr.setRequestHeader("SOAPAction","invoke");
}
I want to be able to pass the url variable to the passToProxy function (want to replace "http://localhost:8088/mockSDClientSOAPBinding" with a variable url), but I don't think I have the right idea here. The alert in passToProxy pops up "undefined." What am I doing wrong?
Perhaps you want:
beforeSend: function(xhr){ passToProxy(xhr, url); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With