Code for sending articles to mobile phones based on jquery, jquery code

Source: Internet
Author: User

Code for sending articles to mobile phones based on jquery, jquery code

I wrote a piece of code when I was working on a project some time ago. It was very practical and I will record it and share it with you.

Copy codeThe Code is as follows:
<A class = "btn_fankui relative" id = "btn_fankui" style = "top: 7px;">
<Div class = "qr_content" id = "fankui_1" style = "top: 40px; left:-25px;">
<Span> </span>
<Form class = "fankui_form" action = "">
<Table>
<Caption> send an article to your mobile phone </caption>

<Tr>
<Td align = "right" valign = "middle"> <label for = "mphno"> mobile phone number </label> </td>
<Td> <input class = "input" name = "mphno" type = "text" id = "input_phone"/> </td>
</Tr>
<Tr id = "p_memssage">

</Tr>
<Tr>
<Td colspan = "2" align = "right" id = "short_d"> <input name = "" type = "button" class = "fankui_tijiao" value = "Submit" /> </td>
<Td colspan = "2" align = "center" id = "short_n" style = "display: none"> Please wait </td>
</Tr>
</Table>
</Form>
</Div>
</A>
<Script type = "text/javascript">
$ ("# Btn_fankui"). toggle (function (){
$ ("# Fankui_1"). fadeIn (1 );},
Function (){
$ ("# Fankui_1"). fadeOut (1 );});
$ ("# Fankui_1"). click (function (e) {e. stopPropagation ();});
$ (". Fankui_tijiao"). click (function (){
Var phone = $ ("# input_phone"). val ();
Var content = "the address of your subscribed Article {$ title} is: {$ url }";
Var p1 =/^ (\ d {3} \) | (\ d {3 }\-))? 13 \ d {9} | 15 \ d {9} $ /;
If (p1.test (phone )){
$ ("# P_memssage" 2.16.html ("");
$. Ajax ({
Url: "{APP_PATH} index. php? M = content & c = phone & a = sms ",
Type: "POST ",
DataType: "html ",
Data :{
"Id": "{$ id }",
"Mobile": phone,
"Content": "the url of your subscribed Article {$ title} is: {$ url }",
"Rip": "{php echo ip ()}",
},
Error: function (data1, data2 ){
Alert (data2 );
Alert ("submission error! Please try again later! ");
},
BeforeSend: function (){
$ ("# Short_d"). hide ();
$ ("# Short_n" ).css ("display", "block ");
},
Success: function (data ){
$ ("# Fankui_1" ).css ("display", "none ");
$ ("# Short_d"). show ();
$ ("# Short_n" ).css ("display", "none ");
Alert (data );
}
});

} Else {
$ ("# P_memssage" 2.16.html ("<td colspan = '2'> <center> <font color = 'red'> Please enter your mobile phone number correctly </font> </ center> </td> ");
Return false;
}
});
$ ("# Fankui_2"). click (function (){
$ (This). hide ();
})
</Script>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.