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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.