Jump to content
Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Sign in to follow this  
TienSchuit

Need to Solve a JSONP issue and problem with responsive design

Recommended Posts

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. 
 

Share this post


Link to post
Share on other sites

"I will be thankful if you could recommend some custom solution to this issue. "

 

My suggestion would be to ask someone who understands computers.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy