Created
September 15, 2011 12:48
-
-
Save adamtait/1219155 to your computer and use it in GitHub Desktop.
JavaScript SendRequest for use with PHP proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function SendRequest ( request, responseHandler, error ){ | |
var content = { url: "http://test.expanz.com/portal/ESAService.svc/restish/ExecAnonymousX", | |
data: request | |
}; | |
$.ajax({ | |
type: 'POST', | |
url: '~/proxy.php', | |
crossDomain: true, | |
data: content, | |
dataType: "xml", | |
processData: true, | |
complete: function(res) { | |
*function( HTTPrequest ){ | |
if( HTTPrequest.status != 200 ){ | |
eval( error )( 'There was a problem with the last request.' ); | |
} else { | |
var response = HTTPrequest.responseText; | |
if( responseHandler ){ | |
eval( responseHandler )( response ); | |
} | |
} | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment