Jump to content

Multiple prompts within the same function


refiking

Recommended Posts

Should I try to split this up into a new function or something?  I'm lost.  When I go through the process and select zip code, it prompts me to enter my zip code, but I can't click continue.  If I need to make it a new function, can you show me how and where I should implement it?

 

<script type="text/javascript">
    
    function findstore(){
        var txt = 'Step 1: Select your store by:<br><input type="radio" name="type" value="dropdown"> Dropdown Menu<br><input type="radio" name="type" value="zipcode"> Zip Code Search';
        
        $.prompt(txt,{ 
            buttons:{'Confirm':true, 'Cancel':false},
            submit: function(v,m,f){
                var flag = true;
                if (v) { }
                return flag;
            },
            callback: function(v,m,f){
                
                if(v){		
				if(f.type == 'dropdown'){
			document.getElementById('demo').innerHTML = '<table align="center"><tr><td><img src="images/ajax-loader.gif"></td></tr></table>';
			var type = f.type;
                     $.post('findstore.php',{type:type},
                           function(data){
                           $("div#demo").html(data);
                           }
                   	 );
                	}
				if(f.type == 'zipcode'){
				var txt = 'Step 2: Enter your zipcode: <input type="text" name="zip"';

				$.prompt(txt,{ 
					buttons:{'Confirm':true, 'Cancel':false},
					submit: function(v,m,f){
						var flag = true;
						if (v) { }
						return flag;
					},

					callback: function(v,m,f){

						if(v){		
						 $.post('findstore.php',{type:'zipcode',zip:c.zipcode},
							   function(data){
							   $("div#demo").html(data);
							   }
						 );
						}
					}
				});
				}
			}
            }
        });
    }


</script>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.