开发者

how to send email address via ajax using jquery

var emailid='sample@email.com'
var data='email='+emailid;
    $.ajax({
               type: "POST",
      开发者_如何学C         url: "sample.php",
               data: data,
               dataType: "text",
    });

i am sending emailid to server via ajax. whether i need to encode or decode email id while sending. Help me while sending email address via ajax how to encode and decode it.


Don't pass a string to data; use an object and let jQuery handle the encoding:

var emailid = 'sample@email.com',
    data = { email: emailid };
$.ajax({
           type: "POST",
           url: "sample.php",
           data: data,
           dataType: "text"
});

Note that I have removed the comma from after dataType so that your call will work in IE 6 & 7.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜