[英]Sweet Alert http request with Angular doesn't work
我正在用Sweet Alert創建一個表單,並且在swal函數內部有一個post請求,但是當我點擊Submit時,什么也沒發生。 希望能有所幫助。
$scope.formModal = function(){
swal({background:'#ACF1F4',html:"<form method='post' id='loginform'>Username:
<input id='username' name='username' >
<br><br>Password:<input type='password' id='password' name='password'><br> <br></form>",
confirmButtonText: 'Submit',showCancelButton: true}
, function(){
$http.post("login.php",{"username":username,"password":password})
.success(function(data){swal(data)})
}
);
}
這里有多個問題:
swal
通話結束時錯過了')' title
參數,對於swal
是必填的 我不太確定是否可以在SweetAlert中創建表單,至少在他們的頁面中沒有示例。
swal({background:'#ACF1F4', html:true, title:"<form method='post' id='loginform'>Username: <input id='username' name='username' style='width: 100%' ><br><br>Password:<input type='password' id='password' name='password'><br> <br></form>",
confirmButtonText: 'Submit',showCancelButton: true})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.