Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to use PHP+Ajax to realize the lucky draw program of mobile terminal Nine Miyagi

Shulou Source: shulou.com Published: 2022-06-01 10:36:38 10月03日 Update

This article mainly explains "how to use PHP+Ajax to realize the mobile Jiugong lucky draw program". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to use PHP+Ajax to realize the mobile Jiugong lucky draw program".

PHP+Ajax combined with an example of the lucky draw for a Wechat mobile phone made by lottery.js. After the completion of the lucky draw, a form for adding the receiving address appears. Support can set the winning probability and so on.

Prize list

Ajax lucky draw

$.post ("ajax.php", function (data) {/ / get the prize. You can also determine whether the login status is if (data.prize_id! =''& & data.prize_id! = undefined) {var prize_site = $(".lottery -" + data.prize_id) .attr ("data-ord"); $("# lottery") .attr ("prize_site", prize_site) $("# lottery"). Attr ("prize_id", data.prize_id); $("# lottery"). Attr ("prize_name", data.prize_name); $("# lottery"). Attr ("prize_pic", data.prize_pic); if (data.code = = 200) {$("# lottery"). Attr ("contact_name", data.contact_name) ("# lottery"). Attr ("contact_mobile", data.contact_mobile); $("# lottery"). Attr ("contact_addr", data.contact_addr);} roll (); click = true; return false;} else {showLotteryTip (data.error);}}, "json")

Save the receiving address

$.post ("ajax.php", {contact_name: contact_name, contact_mobile: contact_mobile, contact_addr: contact_addr}, function (data) {$("# lottery_addr_box"). Modal ('hide'); if (data.code = = 200) {$("# tip_words"). Html ("submitted successfully!") ; getModalBox ('# lottery_tip');} else {showLotteryTip (data.error) }, "json") Thank you for your reading. The above is the content of "how to use PHP+Ajax to realize the mobile Jiugong lucky draw program". After the study of this article, I believe you have a deeper understanding of how to use PHP+Ajax to realize the mobile Jiugong lucky draw program, and the specific use still needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Nine houses mobile phones programs learning content addresses prizes successes examples that is ideas situations articles more probability status knowledge knowledge points articles forms Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Shulou Information Huawei MySQL Shulou Tech Info