Php Ajax Post方法为空

Php Ajax Post方法为空,php,jquery,ajax,codeigniter,post,Php,Jquery,Ajax,Codeigniter,Post,我使用的是jQueryAjax,代码运行良好,直到站点被移动到新服务器,不知何故,在新服务器上,ajax post方法没有通过post方法传递任何数据,也没有给出任何响应。我正在使用codeigniter框架 以下是我的代码片段: $(document).ready(function() { //alert(progressbar.width); //alert($('.upload-statusbar').width()); var c =0; var sett

我使用的是jQueryAjax,代码运行良好,直到站点被移动到新服务器,不知何故,在新服务器上,ajax post方法没有通过post方法传递任何数据,也没有给出任何响应。我正在使用codeigniter框架

以下是我的代码片段:

$(document).ready(function()
{
    //alert(progressbar.width);
    //alert($('.upload-statusbar').width());
    var c =0;
    var settings = {
    url: "class_name/function_name",
    method: "POST",
    //allowedTypes:"jpg,png,gif,doc,pdf,zip",
    allowedTypes:"jpg,png,gif",
    fileName: "userfile[]",
    multiple: true,
/*  onbeforeSend:function()
    {
        $('#submitBtn').prop('disabled','true');
        alert('upload starts');
    },*/
    onSelect:function()
    {
        //alert("Wait untill image being uploaded !!");
        $('#submitBtn').attr('disabled','true');
        $('#submitBtn').addClass('disabled-button');
        $('.disabled-div').css('display','block');
    },
    onSuccess:function(files,data,xhr)
    {
        //alert(data);
        c++;
        //alert(c);
        var x = data;
        image = "http://domain.com/folder_name/"+data;
        //alert(x);
        var use_class = data.substr(0, data.lastIndexOf('.'));
        //alert(use_class);
        $("#status").html("<font color='green'>Upload is 100%</font>");
    },
    afterUploadAll:function()
    {
        alert('all images uploaded');   
    },
    onError: function(files,status,errMsg)
    {       
        $("#status").html("<font color='red'>Upload is Failed</font>");
    }
}
$("#mulitplefileuploader").uploadFile(settings);
});
$(文档).ready(函数()
{
//警报(进度条宽度);
//警报($('.upload statusbar').width());
var c=0;
变量设置={
url:“类名称/函数名称”,
方法:“张贴”,
//允许的类型:“jpg、png、gif、doc、pdf、zip”,
允许的类型:“jpg、png、gif”,
文件名:“userfile[]”,
多重:对,
/*onbeforeSend:function()
{
$('submitBtn').prop('disabled','true');
警报(“上传开始”);
},*/
onSelect:function()
{
//警报(“等待图像上传!!”;
$('submitBtn').attr('disabled','true');
$('#submitBtn').addClass('disabled-button');
$('.disabled div').css('display','block');
},
onSuccess:函数(文件、数据、xhr)
{
//警报(数据);
C++;
//警报(c);
var x=数据;
图像=”http://domain.com/folder_name/“+数据;
//警报(x);
var use_class=data.substr(0,data.lastIndexOf('.');
//警报(使用_类);
$(“#状态”).html(“上传为100%”;
},
afterUploadAll:function()
{
警报(“上传的所有图像”);
},
onError:函数(文件、状态、errMsg)
{       
$(“#状态”).html(“上传失败”);
}
}
$(“#mulitplefileuploader”).uploadFile(设置);
});

谢谢

尝试在ajax url部分传递完整的url。。。 像

网址:“

或者尝试下面的代码进行ajax图像上传

var url = BASE_URL + 'class_name/function_name';

    var xhr = new XMLHttpRequest();
    xhr.open('POST', url);
    $('#image').attr('src', BASE_URL + "artefacts/images/site/loading.gif");


    xhr.upload.onprogress = function(e) {
        /*
         * values that indicate the progression
         * e.loaded
         * e.total
         */

        $('#image').attr('src', BASE_URL + "images/loading.gif");

        $('#image').show();
    };
    xhr.onload = function() {
        if (xhr.readyState === 4 && (xhr.status === 200 || xhr.status === 0)) {
            // if your server sends a message on upload sucess,
            // get it with xhr.responseText
            //alert(xhr.responseText);

            var responseData = eval('(' + xhr.responseText + ')');

            var dimension = String(width) + 'x' + String(height);

            $('#image).hide();

            // Display error messages on view page starts - 10/12/2014
            if (responseData.error !== null)
            {
                $('#image').attr('src', BASE_URL + "images/Pic.png");

                $('#image').show();
                $('.showMsg').html(responseData.error[0]);
            }

            // Check if image has been uploaded successfully
            if (responseData.success !== null) {

                $('#image').attr('src', BASE_URL + 'images/' + responseData.success[dimension] + '?' + new Date().getTime());

                $('#image').show();

                $('#uploaded_image').val(responseData.success[dimension]);

            }
        }
    };
    // upload success
    var form = new FormData();
    form.append('title', file.files[0].name);
    form.append('profile_photo', file.files[0]);

    xhr.send(form);

忽略与您无关的代码行

你有没有试过像这样把基本url添加到你的url设置中,比如“类\名/函数\名”??我总是面临这个问题,因为url没有正确指定。第一个逻辑步骤不是添加一些ajax错误处理吗?另外,在浏览器控制台的ClueStanks every1网络选项卡中检查请求,以获取您的建议,但问题与codeigniter中的upload.php一样。