mva*_*sco 0 javascript ajax jquery
我正在尝试从 Ajax 函数打开 URL,但未调用该 URL。
这是我的代码:
$(document).on( "click",".btndriver", function() {
var id = $(this).attr("id");
var nombre = $(this).attr("nombre");
swal({
title: "Select Driver?",
text: "Select Driver? : "+nombre+" ?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "GO",
closeOnConfirm: true },
function(){
var value = {
id: id
};
$.ajax(
{
url : "ondemand_driver.php",
type: "POST",
data : value,
success: function() {
window.location(url);
}
});
});
});
Run Code Online (Sandbox Code Playgroud)
有什么问题吗?
您不能像那样调用对象属性键。它不是一个变量。
只需这样做:
var url = "ondemand_driver.php";
$.ajax({
url : url,
type: "POST",
data : value,
success: function() {
window.location = url;
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9348 次 |
| 最近记录: |