Jump to content

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. 
 

Link to comment
Share on other sites

  • 1 month later...

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.

 Share

×
×
  • 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