Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 841387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:47:12+00:00 2026-05-15T05:47:12+00:00

We have published a json api to share data between a few domains. We

  • 0

We have published a json api to share data between a few domains. We provide a callback that allows any GETs from remote sites to be returned as padded json.

GET http://mysite.com/jsonapi/object?callback=?

Returns: ?({‘someKey’:’someData’})

Now all of this works fine whenever we are GET’ting data from remote sites, but the moment that I attempt to do a remote jquery POST to the api to fetch json data, I get a null return in Firefox. I can post a form from a remote site to the json API without any problem and get back json data. The problem only arises with jquery POSTs. I imagine that this is some sort of protection against cross-site scripting that I don’t completely understand. When I jquery POST data to a url on the same site that I download the jquery POSTing page from, I don’t have the issue.

How do I do a jquery post to a remote site and process the json data that I get back? I can add a call back or make some other type of modification to the json data being returned and I’m not worried about security. I just want to be able to jquery post a form rather than pass the parameters as a GET.

How would I modify this to jquery POST to a remote site?

<form method="post" action="http://www.remoteSite.com" name="input">
        Quick form to test update public data:<br>
        New data:<input type="text" value="New Data" name="newData"><br>
        <input type="submit" value="Submit">
</form>

<script src="_js/jquery-1.4.2.min.js" type="text/javascript"> </script>
<script type="text/javascript">
$("form").submit(function(e){
    var form = $(this);
    $.ajax({ 
         url   : form.attr('action'),
         method: form.attr('method'),
         data  : form.serialize(), // data to be submitted
         success: function(response){
            alert(response); // do what you like with the response
         }
    });
    return false;
 });
</script>

This currently returns [JavaScript Application] as the alert rather than the expected json return data.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T05:47:13+00:00Added an answer on May 15, 2026 at 5:47 am

    The same-origin policy kicks in when you attempt to post through javascript, obvious reasons behind this include posting potentially sensitive information without the user knowing (via ajax). Jquery does support JSONP, this technique allows sending data to a site outside of your domain, and it does so by creating a element dynamically on your page, which wraps the response in a function call. The thing to note here though, is that you can’t do a POST with a element as its requested through GET.

    $.ajax({
         url   : form.attr('action'),
         method: form.attr('method'),
         data  : form.serialize(), // data to be submitted
         success: function(response){
            alert(response); // do what you like with the response
         },
         dataType: 'jsonp'
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a json object that I'm loading from wordpress using the JSON API
I have a field containing raw HTML published via JSON that was recently converted
I have a web site with an API which publishes the information using JSON.
I read everywhere that rewriting history of commits that have been published is bad
I am using an API that outputs JSON objects with many attributes including sub-objects.
I am using WCF Web API service to publish some data via Json and
i have published my project and exe file has been created.... now i want
I have follwing erorr after I have published site in IIS 7.5 and i
Let’s start with this statement: We have published couple of free applications on the
I have two Visual Studio vb.NET applications. Previously, I have published each application separately

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.