how to call php function from javascript function 1. create Folder on WWW Or htdocs (on your computer) 2. create index.php page on your folder and paste this code index.php <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script> function addsearchproduct(x){ // this is JavaScript function $.ajax({ type: 'POST', url: "function.php?f=phpFunction&p="+x, // call php function , phpFunction=function Name , x= parameter data: {}, success: function(data1){ alert(data1); } }); } </script> <input type="button" value="call Php Function" onclick="...
for example show this type Category 1 post1 post 2 post3 category 2 post 1 post 2 Category 3 post1 post 2 post3 code : <?php // get all the categories from the database $cats = get_categories (); // loop through the categries foreach ( $cats as $cat ) { // setup the cateogory ID $cat_id = $cat -> term_id ; // Make a header for the cateogry echo "<h2>" . $cat -> name . "</h2>" ; // create a custom wordpress query query_posts ( "cat=$cat_id&post_per_page=100" ); // start the wordpre...
Comments
Post a Comment
If you Satisfied , Please Leave a comment