获取JSON数据404(未找到) [英] Get JSON data 404 (Not Found)

查看:93
本文介绍了获取JSON数据404(未找到)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,这很奇怪.尝试测试代码时出现以下错误.由于某种原因,我的URL地址显示为两次.

OK this is strange. I am getting the following error when i try to test my code. For some reason, my URL address is showing as twice.

GET http://howtodeployit.com/howtodeployit.com/api/get_recent_posts/ 404 (Not Found) 

JS:

$(document).on('pagebeforeshow', '#blogposts', function() {     
    //$.mobile.showPageLoadingMsg();    
        $.ajax({
            url: "http:/howtodeployit.com/api/get_recent_posts/",
            dataType: "json",
            jsonpCallback: 'successCallback',
            async: true,
            beforeSend: function() { $.mobile.showPageLoadingMsg(true); },

            complete: function() { $.mobile.hidePageLoadingMsg(); },
            success:function(data){
                console.log(data);
            // successful request; do something with the data
              $('#postlist').empty();
              var html = '';
                for (i=0; i<data.posts.length; i++) {
                html += '<li>' + data.posts.title + '</li>';
               }
               $("#postlist").append(html).listview("refresh");
             },

            error: function (request,error) {
                alert('Network error has occurred please try again!');
            }
        });
    });

推荐答案

您在这里缺少第二个斜杠:"http:/howtodeployit.com/api/get_recent_posts/",您可能想要"http://howtodeployit.com/api/get_recent_posts/"

You're missing second slash here: "http:/howtodeployit.com/api/get_recent_posts/", you probably want "http://howtodeployit.com/api/get_recent_posts/"

这篇关于获取JSON数据404(未找到)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆