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 9120051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:32:33+00:00 2026-06-17T05:32:33+00:00

Possible Duplicate: Ways to circumvent the same-origin policy For example i have a 2

  • 0

Possible Duplicate:
Ways to circumvent the same-origin policy

For example i have a 2 domain “http://domain1.com/info.php” and the other one is “http://domain2.com/script.html“

now the first domain “http://domain1.com/info.php” is releasing json encoded data like this

{
    "str_info": [
        {
            "str_name": "Mark",
            "str_age": "22"
        },
        {
            "str_name": "Aliza",
            "str_age": "52"
        }
    ]
}

what the second domain “http://domain2.com/script.html” does is to retrieve and manipulate the data given by the first domain.

i don’t know how to connect and retrieve the data came from the first domain which is “http://domain1.com/info.php” to the second domain which is the script.
so can you please show me how using jsonp, jquery, ajax if possible

  • 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-06-17T05:32:34+00:00Added an answer on June 17, 2026 at 5:32 am

    From jQuery.org

    Due to browser security restrictions, most “Ajax” requests are subject
    to the same origin policy; the request can not successfully retrieve
    data from a different domain, subdomain, or protocol.

    Script and JSONP requests are not subject to the same origin policy restrictions.

    If working crossdomain you can use a method called JSONP
    The ajax request adds a parameter ?callback=callbackname and your server answers with

    callbackname
    (
        {
            "str_info": [
                {
                    "str_name": "Mark",
                    "str_age": "22"
                },
                {
                    "str_name": "Aliza",
                    "str_age": "52"
                }
            ]
        }
    );
    

    The function then is executed on your client.
    You can use jQuery to get this done very simple

    $.getJSON("http://domain1.com/info.php?callback=?", function(data) {
      alert("success");
    });
    

    in PHP you would wrap your result like this (simple example)

    echo $_GET['callback'], '(' , json_encode( $data ), ')';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Ways to circumvent the same-origin policy I have url contain html. http://s3test.sirahu.net/12518%3A11679%3A581?&AWSAccessKeyId=AKIAJEI7M6ZBESTUUDIA&Expires=1357973634&Signature=2G7M2uQJ%2Ba9LJUcGgEbxcItsBKQ%3D
Possible Duplicate: Ways to circumvent the same-origin policy Is it possible to enable cross-domain
Possible Duplicate: Ways to circumvent the same-origin policy Is there anyway to get content
Possible Duplicate: How do I make a request using HTTP basic authentication with PHP
Possible Duplicate: Php array_push() vs myArray[] Hello folks. I know some ways to add
Possible Duplicate: Python: Elegant and efficient ways to mask a list I have two
Possible Duplicate: How can I understand nested ?: operators in PHP? Why does this:
Possible Duplicate: What's the rationale behind curried functions in Scala? I have two difference
Possible Duplicate: JSON Spec - does the key have to be surrounded with quotes?
Possible Duplicate: CSS: Ways to break list into columns on page? I was looking

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.