我得到undefined
当我运行此代码时,提示什么似乎是造成这个问题?越来越UNDEFINED值AJAX JSON
这是我insert_home.php
else if(isset($_POST['SELECTSLIDE']))
{
$SSID = ($_POST['SELECTSLIDE']);
$result = mysqli_query($con,"SELECT *FROM slider SLIDE_NUM=('$SSID')");
while($row = mysqli_fetch_array($result)){
echo json_encode(array("a" => $row['SLIDE_TITLE']));
}
mysqli_close($con);
}
,这是我的javascript
function SLIDE_EDIT(SLIDEID)
{
$.post('insert_home.php',{SELECTSLIDE:SLIDEID}).done(function(data){
alert(data.a);
});
}
你做了什么来调试呢?您是否检查过HTTP响应(使用浏览器的开发人员工具的“网络标签”)来查看它是否符合您的期望?数据是否正确?内容类型是否正确? – Quentin