簡體   English   中英

Ajax POST發回空響應

[英]Ajax POST sending back empty response

我遇到了Ajax和POST的問題,因為它不起作用,發送一個空響應,我正在處理文本(而不是Json)數據。

這是javascript代碼:

$.ajax({
    type: "POST",
    url: "php/bddAlumnoElements.php",
    data: "methodo=setLecturas,idLectura="+CurrentLecture,
    async: true,
    success: function(response) {
        alert(response);
    },
    cache: false,
    contentType: false,
    processData: false
});
return false;

這是我正在使用的簡單的PHP代碼

if(isset($_POST['methodo'])){
    echo "blah!";       
}

我也試過像這樣的PHP代碼

if(isset($_POST['methodo'])=="setLecturas"){
    $message= "blah!";      
}

響應警報始終為空白,因此我不知道發生了什么,有什么建議嗎?

在這里改變,&

   data: "methodo=setLecturas&idLectura="+CurrentLecture,

參數由符號分開&不使用逗號,所以methodo值變為無用concatination用逗號。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM