CopyPastor

Detecting plagiarism made easy.

Score: 0.8125266432762146; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2018-12-31
by Dipak384

Original Post

Original - Posted on 2013-03-19
by Tahir Yasin



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Please try this code :
Add this code in your function.php file
function AjaxCallBack() { foreach($_POST as $key=>$value) $$key = $value; //Email script will go here! die(); }
// creating Ajax call for WordPress add_action('wp_ajax_nopriv_MyAjaxCallBack', 'AjaxCallBack'); add_action('wp_ajax_AjaxCallBack', 'AjaxCallBack');
And Add this code in your header.php or footer.php
jQuery(document).ready(function() { jQuery("#PleasePushhere").click(function(){ //PleasePushhere this is your html form id jQuery.ajax({ type: 'POST', url: '<?php echo admin_url('admin-ajax.php');?>', data: { action: 'MyAjaxCallBack', MyParam: 'MyParamValue' }, success: function(data, textStatus, XMLHttpRequest){ alert(data); }, error: function(MLHttpRequest, textStatus, errorThrown){ alert(errorThrown); } }); }); });
I hope this is helps you.
Thank you.
Best way to implement Ajax in WordPress is to use admin-ajax.php
In your functions.php of your template add following code
function MyAjaxCallBack() { foreach($_POST as $key=>$value) $$key = $value; //Email script will go here! die(); } // creating Ajax call for WordPress add_action('wp_ajax_nopriv_MyAjaxCallBack', 'MyAjaxCallBack'); add_action('wp_ajax_MyAjaxCallBack', 'MyAjaxCallBack');

Ajax script (Add it to header.php or footer.php):
jQuery(document).ready(function() { jQuery("#PleasePushMe").click(function(){ jQuery.ajax({ type: 'POST', url: '<?php echo admin_url('admin-ajax.php');?>', data: { action: 'MyAjaxCallBack', MyParam: 'MyParamValue' }, success: function(data, textStatus, XMLHttpRequest){ alert(data); }, error: function(MLHttpRequest, textStatus, errorThrown){ alert(errorThrown); } }); }); });

        
Present in both answers; Present only in the new answer; Present only in the old answer;