在即兴弹出窗口中,我有两个状态,即。状态 1 和状态 2。state2 的“html”数据必须从文件(abc.html)中读取。我尝试读取 state1 中的文件并将其设置为变量并将该变量用作 state2 html 的数据,但它不起作用。
var secondPage = '';
//And when defining states
state0: {
html:'First html',
buttons: { Cancel: false, Next: true },
focus: 1,
submit:function(e,v,m,f){
if(v){
e.preventDefault();
// have tried this but not working
$.get('abc.html', function(data) {
secondPage = data;
$.prompt.goToState('state1');
});
//$.prompt.goToState('state1');
return false;
}
$.prompt.close();
}
},
state1: {
html:secondPage, // this secondPage should be read from a abc.html file
buttons: { Back: -1, Exit: 0, DoSomething: 1 },
focus: 1,
submit:function(e,v,m,f){
e.preventDefault();
if(v==0)
$.prompt.close();
if(v==1)
// do something
else if(v==-1)
$.prompt.goToState('state0');
}
}