jQuery $.post problem with emails
문제
I'm trying to post form data in a lightbox through jQuery and php. There are only 3 field values I need to pass. I do not get any errors on submit, but the emails aren't sending. I'm noticing (through Firebug) that the email addresses that are being entered into a textbox (which are the email addresses the form sends to) are being sent as: '%40' instead of '@'. Has anyone experienced this or know why/how to fix this issue?
My jQuery function is as follows:
$('#notify form').submit(function(){
$.post('path/to/action/to/send/email', { id: $("#id").val(), client_reviews: $("#client_reviewers").val(), client_reviewers_msg: $("#client_reviewers_msg").val() }, function(){
tb_remove();
$('#client_reviewers').val('');
$('#client_reviewers_msg').val('');
});
return false;
});
thanks in advance for any help. j
해결책
What you're seeing is URL encoding.
Basically, the @
is a special character in a URL. So when you submit a field with a special character in it, it has to be escaped. This is most useful in a GET request where the field values actually end up in the URL, but a POST request follows the same rules.
In PHP, you can use the urldecode function to decode this.
다른 팁
%40 is the URL representation of the @ sign. You'll need to URLDecrypt the email in php.