相关疑难解决方法(0)

在发出xml Ajax请求时获取错误412

我最近开始使用JQTouch制作基于Web的应用程序.在这个应用程序中,当按下一个按钮时,我正在制作一个ajax请求,从我运行Apache的Linux服务器获取一个xml文件.当我通过wifi运行我的应用程序时,一切都运行良好.当我超过3克并按下按钮时,它也会加载.但是当我再次按下按钮时,我收到错误412的警报:前提条件失败.我在互联网上搜索了这个错误,我发现我必须在我的服务器上禁用mod_security,但这并不能解决错误:(

这是我的ajax请求:

$.ajax(
{
    type: "POST",
    cache: false,
    url: "http://draughtsonline.no-ip.org/ArtObject/catalogus/catalogus.xml",
    dataType: "xml",
    success: function(xml) 
    {
        // do stuff with the xml file
    },
    error: function(xhr, ajaxOptions, thrownError)
    {
        alert(xhr.status);
        alert(thrownError);
    },
    async: false
});
Run Code Online (Sandbox Code Playgroud)

我真的不知道它有什么问题.有人可以帮帮我吗?

提前致谢!

xml ajax jquery

3
推荐指数
1
解决办法
6187
查看次数

访问chrome net :: ERR_INSECURE_RESPONSE中的localhost api时出错

我试图使用angular $ resourses访问在localhost中运行的api,chrome console给出了错误说ERR_INSECURE_RESPONSE.

我尝试在Chrome中禁用网络安全性.还是一样的错误.这是我使用的角度工厂.如何绕过此错误并测试我的应用.

    ImpactPortal.factory('apiFactory', function ($resource) {
    return $resource('https://localhost:8443/mifosng-provider/api/v1/client_impact_portal', {}, {
        query: {
            method: 'GET',
            params: {},
            isArray: true
        }
    })
});
Run Code Online (Sandbox Code Playgroud)

google-chrome angularjs angular-resource

3
推荐指数
1
解决办法
1万
查看次数

Jquery Ajax/GET方法成功时没有发生任何事情

我有一个在Glassfish Application Server上运行的RESTful Web服务.当我在cURL上使用/ GET HTTP方法调用Web服务时,存储的条目将被提取到控制台.我想创建一个jQuery REST客户端 - 当我单击该按钮时,它必须提醒我返回的JSON或XML条目.但在成功方法中,没有任何反应.我的html页面如下所示.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ba?l?ks?z Belge</title>

</head>

<body>
<input type="submit" name="kaydet" id="kaydet" value="Kaydet" />
<script type="text/javascript" src="jquery-1.7.2.js"></script>
<script type="text/javascript">
var restURL="http://localhost:43842/KodcuComRESTful/kodcuRS/yazilar";

$('#kaydet').click(function(){
      $.ajax({
    type: 'GET',
    url: restURL,
    dataType:"json",
    success: renderList,
      });
      return false;
});


function renderList(data) {
    alert(data);
}
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

当我在Live HTTP头程序中观察到请求和响应时,似乎一切正常.问题是什么? 在此输入图像描述

jquery get http

1
推荐指数
1
解决办法
3万
查看次数

jquery $ ajax没有按预期工作

我必须使用$ .ajax函数执行跨域请求并从URL获取内容.但是下面的代码只显示第一个警报,即警报(myUrl),之后执行停止.第二个警报不显示.我不知道我写的代码有什么问题.谁能告诉我我在这里做错了什么?先谢谢你.

function getContentFromUrl(){
    var myUrl="http://icant.co.uk";
    alert(myUrl);
    $.ajax({
        url: "http://query.yahooapis.com/v1/public/yql?" +
             "q=select%20*%20from%20html%20where%20url%3D%22" +
             encodeURIComponent(myUrl) + "%22&format=xml'&callback=?",
        dataType: 'json',
        data: data,
        success: function () {
            alert("***********"+data.results[0]);
            if (data.results[0]) {
                var htmlText = data.results[0];
            var jsonObject = parseAndConvertToJsonObj(htmlText);
            } else {
                document.getElementById("displayerrors").innerHTML = "Could not load the page.";
            }
        },
        error: function() {
            document.getElementById("displayerrors").innerHTML = "Could not load the page.";
        }
    });
}  
Run Code Online (Sandbox Code Playgroud)

javascript jquery

1
推荐指数
1
解决办法
2662
查看次数

如何针对Google Api撤消身份验证令牌客户端

我正在尝试使用Google Api客户端代码撤消令牌.

我的代码看起来像这样:

$.get("https://accounts.google.com/o/oauth2/revoke?token=" + accessToken, function () {
        window.location.reload();
    }); 
Run Code Online (Sandbox Code Playgroud)

我收到以下错误?

XMLHttpRequest无法加载 https://accounts.google.com/o/oauth2/revoke?token=tokenishere来自Access-Control-Allow-Origin不允许来源 http://balblabla.com.

javascript jquery oauth google-api google-analytics-api

1
推荐指数
1
解决办法
4408
查看次数

Ajax 帖子不适用于外部域

也许我是问这个问题的第 N 个用户,但我想不通。

ajax调用的数据串好像是空的还是什么?要么我没有得到任何关于成功或错误功能的反馈。

$.ajax({
  type:'POST',
  url:'http://www.example.com/test.php',
  data:'lid=test',
  succes: function(data){
    console.log(data);
  },
  error:function(data){
    console.log(data);
  }
});
Run Code Online (Sandbox Code Playgroud)

我希望有人能帮我解决这个问题吗?

亲切的问候,

坦率

javascript ajax jquery

1
推荐指数
1
解决办法
5870
查看次数

当URL被复制到地址栏时,GET工作,但不能通过AJAX

我有一系列端点,供应商的应用程序可以从中获取文件.如果我将这些端点输入到浏览器的地址栏中,则会打开该文件,但如果我尝试通过jQuery AJAX获取它们,则会因为跨源错误而失败(No'Access-Control-Allow-Origin'标头是出现在请求的资源上.因此不允许来源' http:// mydomain '访问.).供应商应用程序REST Web服务不支持CORS.这是我的AJAX调用:

$.ajax({
    url: "http://vendorrestwebservice/endpoint",
    type: "GET",
    success: function (result) {
    console.log("downloaded file");
  },
  error: function (error) {
    console.log("Failed to download file!");
  }
});
Run Code Online (Sandbox Code Playgroud)

为什么文件在粘贴到地址栏时打开,而不是在通过我的GET请求调用时打开?

javascript ajax rest jquery

-1
推荐指数
1
解决办法
2354
查看次数