Use JQuery's getJSON Method for cross-origin access in WebWorks

Source: Internet
Author: User
Problems: 1. in the test environment, neither Firefox nor Chrome can call back the checkSIGNIN_callback method. Diagnosis: Listening to port 89 on the server, arrival of data requests, normal return of JSON format data solution: Debugging Using Ripple of IM 2. test the code on the BlackBerry real machine... syntaxHighligh

Problems:
1. Test Environment
Neither Firefox nor Chrome can call back the checkSIGNIN_callback method.
Diagnosis: Listening to port 89 on the server, Data Request arrival, normal return of JSON format data
Solution: Debug using Ripple of IM

2. Test on the BlackBerry real machine. The code does not successfully perform network access.
Diagnosis: Listening to port 89 on the server finds that no data request arrives or data is returned.
Possible problem: a) access controll B in the config. xml file) access to special port 89 on the carrier (China Unicom) Network
Solution: Modify the port or port ing on the server, change port 89 to port 80, and change port 89 to port 80 in the program.
(To ensure that the original exlive Server user can log on normally, I mapped 89 to two external ports 80 and 89 on the vro)

Code snippet:
[Javascript]
Function checkSIGNIN_callback (data ){
[Javascript] view plaincopy
If (data. signInTime = "") {// not sign in
$ ("# Signin_button"). text ("sign in ");
$ ('# Signin_button'). button ('refresh ');
 
} If (data. signOutTime = "") {// not sign out
$ ("# Signin_button"). text ("check out ");
$ ('# Signin_button'). button ('refresh ');
} Else {
$ ("# Signin_button"). text ("sign-in/check-out ");
$ ('# Signin_button'). button ('refresh ');
}
Alert (6 );
}
Function checkSIGNIN (){
Alert ("gPhone is" + gPhone );
JQuery. support. cors = true;
CheckSIGNIN_url = "http://shanghai.springworks.info: 89/pgps/empPr/empParamAction_sendEmpParam.action? Phone = "+ gPhone;
$. GetJSON (checkSIGNIN_url, checkSIGNIN_callback );
}

Related Article

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.