Skip to content

Instantly share code, notes, and snippets.

@adamtait
Created September 15, 2011 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamtait/1219155 to your computer and use it in GitHub Desktop.
Save adamtait/1219155 to your computer and use it in GitHub Desktop.
JavaScript SendRequest for use with PHP proxy
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