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>