Use JSONP to complete cross-domain requests, but the requested link is JS file, the request is always that JS error, how MO do?

Source: Internet
Author: User
Keywords Jsonp js file php
Jsonpjs file php

Replacing the link with PHP is no problem.

    $.ajax({        type:'GET',        async:false,        url:"http://app.veishu.com/jsonp/categories/all.js",        dataType:"jsonp",        success:function(data){            alert("success");   //         alert(data[0]);   //         var dataHtml=""   //         for(var i=0; data.length;i++){   //             dataHtml+="
  • "; } $(".list").html(dataHtml); }, error:function(){ alert("ajax is error"); } });
        这个ajax不会进入error,也没有进入success。    在那个链接的js那报错。    如果把链接换成php会成功进入success。    但这个js文件的链接直接在浏览器打开也没有问题,可以出现json。不知怎么回事?    还有浏览器打开js文件有unicode字符,该怎么转![图片说明](http://img.ask.csdn.net/upload/201504/25/1429951452_561399.png)
  • 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.