Send parameters to another script without opening it

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • djpaul
    New Member
    • Oct 2006
    • 137

    Send parameters to another script without opening it

    Hello,
    I am just a newbie to javascript, but the most stuff i do is in php or .net.
    But, now i have 2 buttons on my script that are calling a javascript function as shown below (OnClick"").
    Now after a person pushes 1 of the 2 buttons, i want to send some information to a php-file to update my database.
    The only thing that the customer will see is a message from the alert( "Thanks");
    for example.
    This is what i did now:
    Code:
    <script type="text/javascript">
     var Counter = 0;
      function ConfirmPo( value, id ){
    	  
    	  
    	  if( Counter == 0){
    		  
    		  if( value == true ){
    			  
    			  document.location.href = 'http://www.adres.nl/update.php?accept=true&amp;ip=11.11.11.11&amp;id=20';
    
    			  alert("Thanks! The repairing will be carried out." );  
    			  Counter++;
    			  
    		  }else if( value == false ){
    			  
    document.location.href = 'http://www.adres.nl/update.php?accept=false&amp;ip=11.11.11.11&amp;id=20';
    
    			  alert("Thanks! the repair will not be done.");
    			  Counter++;
    			  
    		  }
    				
    	  }else{
    		  
    		  alert("Sorry, you already have made a choice..");
    		  		  
    	  }
      }
      
      </script>
    Maybe it looks odd,but the customer can only press once on button 1 or 2.
    After that it is not possible to change the option he/she made.
    But that is working fine.
    Is it possible to send some vars to my php script without opening a new window?

    Thanks!
    Paul
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    Is it possible to send some vars to my php script without opening a new window?
    this is called AJAX.

    Comment

    Working...