asp.net mvc - Implement response header in Ajax call -
Below is a cross-domain call I am trying to do via an Ajax call. The web service we are using returns only to XML, so I can not use the Here is the code : edit I have tried the following versions of this code and have not seen anything in the error message. It is being used in an enterprise environment, so it is possible that, due to security features on the server, is it not possible to do this work? I'm new to Ajax, so I do not know whether it's something that works 100% or just in most settings. Your problem is in the meat cross-domain request. It is possible and you are on the right track, but HTML5 Boilerplate. See as an example of setting up HTXs on Apache and note browser boundaries - especially that it does not work in IE7 and IE does not support wildcard Trying to copy jsonp (returning the executable JavaScript code to the server) is possible with some clever coding, but it would be more difficult - In addition, If the data is sensitive then you may not want to make any cross-domain request without any private key scheme because I'm not sure the original request headers can be tricked. Option to set up a connection to share your data on back-end rather than front end for your websites. In addition, the names of the JavaScript functions are not capitalized unless they are constructors. jsonp as the
dataType As I wrote it down, I get the following error in Chrome's debugger:
Unfair reference references: The request is not defined
function GetProgramDetails () {var URL = "http: //quahildy01/xRMDRMA02/xrmservices/2011/OrganizationData.svc/AccountSet? select $ = account ID, name, and Neu_UniqueId $ Filter = startwith (name, \ '"+ $ (' search box '). Val () +" \') "; Var SourceDemon = Request Header ["origin"]; Var request = $ .ajax ({type: 'POST', before Sand: function (request) {request.setRequestHeader ( "Access-Control-Allow-Origin" source Dimen)}, url: URL, contentType: "application / x- Www-form-urlencoded ", crossDomain: true, dataType: XMLHttpRequest, success: function (data) {console.log (data); alert (data);}, error: function (data) {console.log (data ); Warning ("Unable to take action on your revival at this time.");}}); }
before: function (request) {request.setRequestHeader ( "Access-Control-Allow-allow-origin: *")}, Phlesend: function (request) {request.setRequestHeader ( " access-Control-translation-parent: "," http: // localhost: 55152 "), Phlesend: function (request) {request.setRequestHeader (" access-Control-allow-origin "," http: // localhost: 55152 ")}, Preceded: function (request) {var sourceDomain = request.Headers [" http: // localhost: 55152 "]; Request.setRequestHeader ("access-control-permission-origin:", SourceDameMan)}, preceded: function (request) {var sourceDomain = location.protocol + '//' + location.host; Request.setRequestHeader ("Access-Control-Allow-Origin:", sourceDomain)},
var sourceDomain = Request.Headers ["Origin"]; You have not defined
request by capital
R
access-control-permission-origin is something that is set on the server as the response header, which is requested by the client through XHR Header is not sent as.
. .
Comments
Post a Comment