Ajax-08 to get the latest TV show list instances across domains

Source: Internet
Author: User
Tags script tag

Goal

Request Jiangxi Network Broadcast TV program

Url:http://www.jxntv.cn/data/jmd-jxtv2.html

Analysis

1. From the HTTP header information analysis, the server server does not return the response header access-control-allow-xxxx related information, so only use Jsonp mode

2. From the content of the return value analysis, the return value is always: List (response content), that is: Because the server writes the function name to list, the specified callback is invalid in this program.

Realize

Get_tv_list.html

<!DOCTYPE HTML><HTMLLang= "en"><Head>    <MetaCharSet= "UTF-8">    <title>Request a list of the latest TV programs across domains</title></Head><Body><H1>Cross-Domain requests</H1><inputtype= "Submit"value= "Xmlsendrequest Get program"onclick= "xmlsendrequest ();"/><inputtype= "Submit"value= "jqsendrequest-Get program"onclick= "jqsendrequest ();"/><Scripttype= "Text/javascript"src= "Http://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></Script><Script>    functionxmlsendrequest () {//Create a script tag        varTag=Document.createelement ('Script'); //Specify SRCtag.src= "http://www.jxntv.cn/data/jmd-jxtv2.html"; //add to head tagdocument.head.appendChild (tag); //Delete a script tagdocument.head.removeChild (tag); }    functionjqsendrequest () {$.ajax ({URL:"http://www.jxntv.cn/data/jmd-jxtv2.html", type:'GET', DataType:'Jsonp'})    }
functionList (ARG) {console.log (ARG); }</Script></Body></HTML>

Ajax-08 to get the latest TV show list instances across domains

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.