对铬的错误,当我尝试AJAX调用当我、错误、AJAX

由网友(⑧離㈧棄)分享简介:当我尝试做一个Ajax调用,我得到了错误的镀铬如下。XMLHtt prequest无法加载的javascript:;。跨起源请求仅支持协议方案:HTTP,数据,镀铬,镀铬的扩展,HTTPS,铬扩展资源。下面是code:$。阿贾克斯({键入:POST,数据:{P值:PID},缓存:假的,网址:xxx.in/yy/ajax...

当我尝试做一个Ajax调用,我得到了错误的镀铬如下。

  

XMLHtt prequest无法加载的javascript:;。跨起源请求   仅支持协议方案:HTTP,数据,镀铬,   镀铬的扩展,HTTPS,铬扩展资源。

下面是code:

  $。阿贾克斯({
    键入:POST,
    数据:{P值:PID},
    缓存:假的,
    网址:xxx.in/yy/ajax.php
    成功:函数(数据)
    {
      $ modal.find(编辑内容。)HTML(数据)。
    }
 
关于jquery用ajax调用文本 完全跟网上教程一样的写,却总是不对 以下代码主要的列出来求大师

解决方案

所有研究的特定错误信息显示主机网页不通过HTTP被加载:// URL,可能是一个文件:URL。该浏览器将不会在默认情况下,允许从一个文件跨起源请求:URL。

您需要通过您的Web服务器,如果你想使用Ajax请求加载网页,而不是通过文件系统。

下面是全部指向了错误的URL类型被用来加载页面其他一些问题和解答有关的特定错误。

"Cross原产地请求仅支持HTTP&QUOT。错误加载本地文件时

React.js:例如,在教程中不工作

Cross原产地请求仅支持HTTP,但它不是跨域

http://answers.playcanvas.com/questions/833/cannot-load-model-due-to-cross-origin-request-being-blocked

https://groups.google。 COM /论坛/#!话题/ tincr换铬devtools / nA9k2qh7F-G

When I try to do a ajax call, I got the error on chrome below.

XMLHttpRequest cannot load javascript:;. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

Here is code:

$.ajax({
    type: "POST",
    data: {pvalue : pid},
    cache: false,
    url: "xxx.in/yy/ajax.php",
    success: function(data)
    {
      $modal.find('.edit-content').html(data);
    }

解决方案

All research into that specific error message suggests that the host web page is not being loading via an http:// URL and is probably a file: URL. The browser will not, by default, permit cross origin requests from a file: URL.

You need to load the web page through your web server, not via the file system if you want to use ajax requests.

Here are some other questions and answers about that specific error that all point to the wrong type of URL being used to load the page.

"Cross origin requests are only supported for HTTP." error when loading a local file

React.js: Example in tutorial not working

Cross origin requests are only supported for HTTP but it's not cross-domain

http://answers.playcanvas.com/questions/833/cannot-load-model-due-to-cross-origin-request-being-blocked

https://groups.google.com/forum/#!topic/tincr-for-chrome-devtools/nA9k2qh7F-g

阅读全文

相关推荐

最新文章