TienSchuit Posted November 10, 2016 Report Share Posted November 10, 2016 I am trying to send requests to jQuery ajax. As per CORS policy using the console, I am getting CORS error on the window. I am seeing a simple header of 'Access-Control-Allow-Origin' requested source. I am using my main page that's the reason, I don't have the access. I am using some custom firefox/custom extension to see the allowed access directly to the origin. I am able to solve the issue using this simple extension and getting the required response from the API. But using the extension is not a good solution, as it does create issues with loading and visitor does not find it pleasing. Another issues, while using the plugin, I am not getting the required response from JSON format. As the format is a string, I am getting an error while passing this to the program. Here is the code with JSONP $.ajax({ url: sendHere,//API url will be placed here type: 'GET', contentType: 'string', crossDomain: false, beforeSend: function(kito){ kito.withCredentials = false; }, }).done(function (outputend) { console.log(outputend); }).error(function (simplee) { //console.log(simplee); }); On executing the above code, I am getting E0002 error. Saying 'It is not defined', where E0002 is the response in the string from the API. I have tried changing the log from outputend to JSON.stringify, but no improvements. I also have tried replacing callback with jsonp. Issue #2: There is another issue, I am facing. And it is more complex compared to the above one. Right now, I am working with a website, this website contains simple design and I have to convert it into more interactive solution. The simple design is part of a div without any responsiveness (or scripting) and the visitor has to scroll all the way down to know about the information. This is bad as far as design issues are concerned. A simple case is http://militarybases.co/r/2016-navy-federal-pay-deposit-dates/. First, it starts with a map, then simple image, then article, then Ads, then rating data and then comments sections. Requirements say, I have to use a script and multiple parent divs to solve the issue rather than simple vertical divs (one after the other). I will be thankful if you could recommend some custom solution to this issue. Quote Link to comment Share on other sites More sharing options...
AlanHo Posted November 10, 2016 Report Share Posted November 10, 2016 My 'ed 'urts...................... Quote Link to comment Share on other sites More sharing options...
catgate Posted November 10, 2016 Report Share Posted November 10, 2016 "I will be thankful if you could recommend some custom solution to this issue. " My suggestion would be to ask someone who understands computers. Quote Link to comment Share on other sites More sharing options...
Boris Posted November 10, 2016 Report Share Posted November 10, 2016 Unfortunately, you will see from the above replies that none of our resident "experts" are able to help with your problem, which appears to be somewhat over our collective heads. Quote Link to comment Share on other sites More sharing options...
AceInfinity Posted December 13, 2016 Report Share Posted December 13, 2016 contentType: 'string' is wrong. That's not a MIME type at all for a valid HTTP header in the request. What you're looking for is 'application/json' or 'application/javascript' for JSONP with callback. Quote Link to comment Share on other sites More sharing options...
Belatucadrus Posted December 13, 2016 Report Share Posted December 13, 2016 Thanks for answering the question AceInfinity, only problem is that TienSchuit appears to be another one of these posters that asks a question then vanishes never to be heard from again. I've taken to only answering stuff that I know, research on somebodys behalf has increasingly become a waste of time. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.