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

  • Home
  • SEARCH
  • 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 6561027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:32:14+00:00 2026-05-25T13:32:14+00:00

I have been trying to write a script where I can post data to

  • 0

I have been trying to write a script where I can post data to a page that is on a different domain than the domain the source page. I read all about the issues with doing that, and information has led me to the jQuery.getJSON function, but I am unsure if this will work.

Here is my scenario:

I have a handful of javascript variables (for this example, lets just use c1,c2,c3,c4 and c5). So, I want to send the values of those 5 variables to a script on another domain.

I understand how I would do this using something like $.get() or $.post() – I would do something similar to this :

$.post("myscript.php", { c1:c1, c2:c2, c3:c3, c4:c4, c5:c5 } );

I am unclear (1) if the getJSON will get me where I need, and (2) if YES, what difference there is in the jQuery call for the getJSON function (vs the .post function), as well as if there is anything different I need to do on the server end (for my purposes, I would just like to display the values back visually for now).

EDIT:
In reading answers, maybe I need to clarify. What I am looking for is a way (if even possible) to send data from one page to another page on a different domain. I understand the security concerns, so if it’s not possible, it sucks but I understand. But if there IS a way using jQuery, that’s what I am looking for (and a small example using my c1 – c5 variables). Thanks.

  • 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-25T13:32:14+00:00Added an answer on May 25, 2026 at 1:32 pm

    Ofcourse you can send data to another server (cross domain) using $.getJSON() in JSONP mode. It’s just that your data must be part of the querystring and you’re limited in the amount of data that you can send since you cannot have infintitely long query strings. There will be no change in how you process data on the server side, since the request will appear as a normal HTTP GET with params.

    Here’s an example lifted from the jQuery API docs. This pulls in the 4 most recent dog pictures from the Flickr JSON API.

    Working Demo

    var c1 = "dog";
    var c2 = "any";
    
    $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?", {
        tags: c1,
        tagmode: c2,
        format: "json"
    }, function(data) {
        $.each(data.items, function(i, item) {
            $("<img/>").attr("src", item.media.m).appendTo("#images");
            if (i == 3) return false;
        });
    });
    

    Notice how c1 and c2 are passed in as GET parameters. The jsoncallback=? parameter instructs jQuery to make the request as a JSONP request and is mandatory while making cross domain calls.

    This is how your script could look:

    var orderId = 1337;
    var customer = encodeURIComponent("John Doe");
    var amount = 420;
    
    $.getJSON("http://www.otherserver?jsoncallback=?", {
        oId: orderId,
        cust: customer,
        amnt: amount
    },
    
    function(data) {
        //process response if any
    });
    

    Sample HTTP request generated:

    http://www.otherserver/?jsoncallback=jQuery16305821700256783515_1315685969538&oId=1337&cust=John%2520Doe&amnt=420&_=1315685969636
    

    HTH.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a script that can control different windows from different programs
I have been trying to write my own diff3 wrap script for SVN and
I have been trying to write a regex that will remove whitespace following a
I have been trying to write a set of htaccess rules that will do
I am trying to write an install script for a system I have been
Have been trying to write an awk script which processes a log file, but
I have been trying to write a small app with its own option windows.
I have been trying to write a bare-bones ping scanner using Perl for internal
I have been trying to write an image on a layer using Quartz but
I am new to programming. I have been trying to write a function in

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.