Php+jquery cross-domain submission problem, don't mind it. It's only 20 points.

Source: Internet
Author: User
Tags domain server
1: A domain server-side output JSON is as follows
$test = "{name:\" john\ ", message:\" Hello john\ "}"; echo $test;

2: The B Domain Server program is as follows
function SendEmail () {var orderingid = $ ("#orderingId"). Val (); alert (orderingid); $.ajax ({type: "Get", url: "// Www.testB.com/cronemail/cron_expressmail.php?orderingid=2222 ", Cache:false,  dataType:" Jsonp ", Jsonp:" Callbackfun ", Jsonpcallback:" Jsonpcallback ",                 success:function (JSON) {alert (json.message);}})}

But the page tip error:
User agent: mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; trident/4.0; SV1;. NET CLR 2.0.50727;. NET CLR 3.0.4506.2152;. NET CLR 3.5.30729)
Timestamp: Tue, Oct 10:48:39 UTC


Message: Script Error
Line: 0
Character: 0
Code: 0
uri:http://www.test.com/cronemail/cron_expressmail.php?orderingid=2222&callbackfun=jsonpcallback&_= 1382438914750


Reply to discussion (solution)

Ajax can't cross domain, that's the fact that it's indisputable
Your code is only a formal cross-domain and is actually

So the URL must return a valid JS statement
Just a JSON string is not enough.

$test = "{name:\" john\ ", message:\" Hello john\ "}"; Echo $_get[' Callbackfun ']. ' ('. $test. ') ';
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.