php - How to retrieve data from serialized jQuery string -
how retrieve data when post using ajax function that
jquery("#wp_pass_reset").submit(function() { var url = document.getelementbyid('imgurl').innerhtml; var url2 = document.getelementbyid('adminurl').innerhtml; jquery('#result').html('<span class="loading"><img src="' + url + '/img/load.gif" /></span>').fadein(); var input_data = jquery('#wp_pass_reset').serialize(); jquery.ajax({ type: "post", url: url2 + 'admin-ajax.php', data: { action: 'resetpass_process', value: input_data, }, success: function(msg){ jquery('.loading').remove(); jquery('<div>').html(msg).appendto('div#result').hide().fadein('slow'); } }); return false; });
this form:
<form class="user_form" id="wp_pass_reset" action="" method="post" name="wp_pass_reset"> <h1> enter email or username </h1> <input type="text" class="text" name="user_input" value=""><br> <input type="hidden" name="action" value="tg_pwd_reset"> <a class="close">x</a> <input type="hidden" name="tg_pwd_nonce" value="'.wp_create_nonce("> <input type="submit" id="submitbtn" class="reset_password btn" name="submit" value="reset password"> </form>
when retrieve data using $_post['value']
of data show when use $_post['user_input']
error happens.
what can do?
here, submitting form ajax have pass in data
like,
data: { action: 'resetpass_process', value: input_data, user_input : $('input[name="user_input"]').val(), // add more parmeters need },
Comments
Post a Comment