Click here to Skip to main content
15,896,111 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i am trying to query a database onClick of a button. I also want to display its result in an alert box.. Any help on how to do this!?
Posted
Comments
Mohibur Rashid 25-Jun-15 20:24pm    
Start searching with Ajax
[no name] 26-Jun-15 2:41am    
Let us your code what you have tried?

1 solution

You can try something like this:

PHP
$.get( "test.php" );

if you need send data into your php function:
$.get( "test.php", { name: "John", time: "2pm" } );


if you need to write data that you get into alert window
$.get( "test.php", function( data ) {
  alert( "Data Loaded: " + data );
});


those are examples from here:
https://api.jquery.com/jquery.get/[^]

If you don't want to read it all just scroll down to examples a try it with examples.

However, if you want to understand how it works read the documentation.

And also this could be useful if you want do more complex things than get.
https://api.jquery.com/jQuery.ajax/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900