javascript - post http request to 3rd party and response with redirect -


i have asp.net mvc project form need send httprequestobject. i'm trying few days make simple xmlhttp request 3rd party credit card clearing company url , response redirect on xml format - don't care if redirection made iframe or popup checked on internet solutions

checked solutions here still nothing work. checked if i'm blocked in way proxy or firewall, , it's not issue.

i tried ajax -

function creatempitransaction() { var terminal_id = "0962832"; var merchant_id = "938"; var user = "user"; var password = "password"; var url="https://cguat2.creditguard.co.il/xpo/relay"; var xmlstr = "xml data" var data = xmlstr; $.ajax({     type: "post",     datatype: 'xml',     data: data,     url: url,     username: user,     password: password,     crossdomain: true,     xhrfields: {         withcredentials: true     } }) .done(function( data ) {     console.log("done");     alert(xhr.responsetext);     alert(textstatus);  }) .fail( function(xhr, textstatus, errorthrown) {     alert(xhr.responsetext);     alert(textstatus); }); alert(data); 

}

i on console -

xmlhttprequest cannot load "url" no 'access-control-allow-origin' header present on requested resource. origin 'http://localhost' therefore not allowed access.

on network tab in chrome see xhr header , form - data no response.

any help?

this common problem alll developer, cross-origin request sharing -domain ajax request issue web developers might encounter, js cannot directly communicate remote server different domain

use flash/silverlight or server side "proxy" communicate remote.

json padding (jsonp) https://en.wikipedia.org/wiki/jsonp. example https://learn.jquery.com/ajax/working-with-jsonp/

embeds remote server in iframe , communicate through fragment or window.name, refer here. http://www.ibm.com/developerworks/library/wa-crossdomaincomm/#n10120

see jsonp easy impliment.


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -