1, problem code At the time of local testing, I had two projects, which would cause the current user to exit when accessed in this way.2, the way to solve
Ways to troubleshoot cross-domain access1. Use the response headerResponse.setheader ("Access-control-allow-origin", "*");//What servers are allowed to accessResponse.setheader ("Access-control-allow-methods", "GET POST");//allowable submission
Here is the code for COCOS2D-JS to request network data:
var HttpRequest = {/* * network request GET * URL Request Network address * Callback CALLBACK parameter * */get:function (url,callback) { var xhr = Cc.loader.getXMLHttpRequest ();
1. Search Webapi in NuGet to find the following extension and add it into the project.2. Add a line of code in Global.asax protected void Application_Start () { // add cors support
How Ajax accesses data across domainsRecent problems encountered in the process of doing a project, a site needs to access the data of another site, and through scripting, and due to the limitations of the same-origin policy, the developer can no
The idea of JSONP is very simple.
Front-end Create script tag, set SRC, add to head (you can add to body)
Backstage returns a JS variable Jsonp, this JSONP is the JSON data after the request
Delete the script tag when the callback
With JSONPTo define the path for the URL to be accessed across domains, the request will become a cross-domain request script file that will trigger the callback function after the request succeeds ListcontactsAjax cross-domain access issues
First, JSONPThe commonly used jquery Framework supports JSONP-mode requests, which only support the Get method, the size of the parameter is limited, and the background needs to be returned based on the JSONP request.Where the parameter Jsonp
The front page test code is as follows:DOCTYPE HTML>HTML>Head> styletype= "Text/css">. Gridtable{font-family:Verdana,arial,sans-serif;font-size:11px;Color:#333333;Border-width:1px;Border-color:#666666;Border-collapse:collapse;}
1.awk arraysSuppose we have a hotelHotel greenThere are several rooms in the hotel 515,516,517,519 these roomsHotel 515 rooms greenhotel[515] Hotel 516 rooms greenhotel[516] Hotel 517 room greenhotel[517] Hotel 519 Room GREENHOTEL[519]Guests staying
Ah hahaha haha haha haha haha i am too excited ~ Actually this work I have been delaying ah, I think wow, it is difficult ah, do not want to do = =Then bite the bullet to study a whole afternoon + night finally made clear ~ ~ ~ Wow haha haha ~ ~ ~ ~
Different domains: protocol, domain name, port any one different;1,JSONP cross-domainIn JS, it is not possible for us to use XMLHttpRequest to request data from different domains directly. However, it is really possible to refer to a JS script file
Because of the nature of the development model of Sencha Touch 2, it basically determines that its native data interaction can be achieved almost exclusively through Ajax.Of course, by calling the powerful PhoneGap plug-in and then packaging, you
JS access resources By default using the same-origin policySame origin: domain name, same portLocalHost and IP address are not homologousAjax cross-domain strict: Sub-domain name, the same domain name and port are different cross-domainFirefox Ajax
Do project encountered an AJAX cross-domain request, in the Internet to find a lot of the relative details of this introduction, but the background processing and I have a bit different, special stickers out for reference.1:action is generally used
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.