Skip to main content

Posts

Showing posts with the label Ajax

How to use Ajax in WORDPRESS

How AJAX Works In WordPress What's AJAX? AJAX stands for Asynchronous JavaScript And XML . It is the use of the XMLHttpRequest object to communicate with servers, which means it can communicate with the server, exchange data, and update the page without having to refresh the page. Step1: Define the Ajax URL. var ajaxurl = '<?php echo admin_url( 'admin-ajax.php' );?>'; Step2: Define its action and perform with using POST method var emailAddress = jQuery('#uemail').val(); var searchData = { action: 'get_registered_email', email_address:emailAddress, } Step 3: Perform ajax request jQuery.ajax({ url: ajaxurl, type: "POST", data: searchData, success: function(data){   jQuery("div#divLoading").removeClass('show');   jQuery('#memberResult').html(data);   //alert(data); }, error: function(errorThrown){ alert(errorThrown); } }); Step 4: Use Wordpress 2 ajax hooks...

How to Upload file using jQuery Ajax PHP

How to Upload file using jQuery Ajax PHP Example 1: Single file upload using jQuery and Ajax Step 1: Create Html Form <form id="data" method="post" enctype="multipart/form-data">     <label>First Name :</label><input type="text" name="firstname" value="" />     <label>Last Name :</label><input type="text" name="lastname" value="" /> <label>Email :</label><input type="email" name="email" value="" /> <label>Contact Number :</label><input type="text" name="phone" value="" />     <label>Upload Profile :</label><input name="image" type="file" />     <input type="submit" value="Submit" /> </form> Step 2: Now create javascript for file uploading       <script>   $...

JSON Jquery Ajax

If use want to trigger ajax on Click   $('.taskStat').live('click',function(){        $.ajax({             type: 'POST',             url: ajax_url+"Members/change_Addtask/"+stat,             success: function(data) {                 var obj=JSON.parse(data);                 if(obj.resp=='true')                 {                     alert("Hello sudhir");                 } else                 {          ...