Use cross-domain requests to hide Ajax requests in the Firbug console

Source: Internet
Author: User
Tags domain server

Ajax requests for ordinary jquery are visible in the console, as follows:

When using JSONP (JSON with padding) for Ajax cross-domain, it is found that Ajax requests are not displayed in the console.

The cross-domain code is as follows:

Front-End Code:

$.ajax ({type:"Get",//Jquey does not support post mode cross-domainAsync:false, URL:"Http://www.cnblog.com",//URL for cross-domain requestDataType:"Jsonp",      //passed to the backend to get the parameter name of the JSONP callback function name (default: callback) to cobble together the return valueJsonp:"Callback",      //Custom JSONP callback function name, default to jquery auto-generated random function nameCallback:"Testcallback",      //This callback function is executed dynamically after a successful acquisition of the JSON data on a cross-domain serverSuccess:function(JSON) {console.log (JSON);  }  }); 

Background:

$callback $_get // value is Testcallback Echo $callback . "({"key":" Value "})";

Instead of a simple JSON string, you can see that the background returned is actually testcallback (JSON string).

In addition, jquery also has a function Jquery.getjson (url,data,success (DATA,STATUS,XHR)) that can also complete cross-domain requests.

Now look at the Firebug console Ajax will not show. If you want to hide in the JS file, consider encrypting JS.

Use cross-domain requests to hide Ajax requests in the Firbug console

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.