Javascript 在backbone.js中使用jquerymobile对话框
我需要在我的项目上添加一个模态对话框。所以情况是我呈现了一个登录页面。登录页面将由两个输入文本字段和两个按钮(登录和连接)组成,现在我需要的是,每当我单击连接(按钮)时,我需要显示一个模式对话框,其中将有一个输入文本字段和一个以前输入的数据列表。这是我到目前为止所做的,但它不起作用Javascript 在backbone.js中使用jquerymobile对话框,javascript,jquery-mobile,backbone.js,requirejs,Javascript,Jquery Mobile,Backbone.js,Requirejs,我需要在我的项目上添加一个模态对话框。所以情况是我呈现了一个登录页面。登录页面将由两个输入文本字段和两个按钮(登录和连接)组成,现在我需要的是,每当我单击连接(按钮)时,我需要显示一个模式对话框,其中将有一个输入文本字段和一个以前输入的数据列表。这是我到目前为止所做的,但它不起作用 connection.tpl.html <div id="connectionContainer" data-role="page" style="width:200px; height: 200px;"&g
connection.tpl.html
<div id="connectionContainer" data-role="page" style="width:200px; height: 200px;">
<input id="serviceUrl" class="user-input"/>
var LoginView = Backbone.View.extend({
events:{
"click .login-btn" : "Login",
"click .connection-btn" : "Connect"
},
initialize: function(){
},
Login: function(){
Const.USERNAME = $("#username").val();
Const.PASSWORD = $("#password").val();
if(!Const.USERNAME || !Const.PASSWORD)
{
alert("Invalid Username/Password!");
$("input").val("");
}else{
var auth = EncodeAuth(Const.USERNAME,Const.PASSWORD);
var sendAuthorization = function (xhr) {
xhr.setRequestHeader('Authorization', auth)
};
this.model.save(this.model, {
beforeSend : sendAuthorization,
success: function(model,result){
if(result.ErrorMessage === null)
{
alert(JSON.stringify(result.Message));
$("input").val("");
}
else
{
alert(JSON.stringify(result.ErrorMessage));
$("input").val("");
}
},
error: function(model,result){
alert("Remote server returned an error. Not Found");
$("input").val("");
}
});
}
},
Connect:function(){
this.connectionview = new ConnectionView({ el: $("#connectionContainer") });
$("#wrapper").html( _.template( ConnectionTemplate ) );
}