0

In the Impromptu popup I have two states viz. state1 and state2. The data for the "html" of state2 has to be read from a file(abc.html). I have tried reading the file in state1 and setting it to a variable and using that variable as the data for state2 html, but its not working.

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');
    }
}
Nav
  • 39
  • 5
  • It is unclear what you are trying to do here. Are you trying to use a switch? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch because you are not doing that correctly. Are you trying to build an Object? Because you are not doing that correctly either. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects#Using_object_initializers – Matt Evanoff Feb 01 '15 at 08:47
  • @RTPMatt Impromptu is a jquery popup extension. http://trentrichardson.com/Impromptu/ And the code given is a part of moving from one popup to another, different states – Nav Feb 01 '15 at 12:00

0 Answers0