Javascript-thinkphp: mobile browser ajax compatibility issues

Source: Internet
Author: User
For a simple form submission page, the test is normal in chrome & amp; ie and fails on Android phones. Environment: thinkphp3.2jquery1.11.3layer-v2.1 the bullet layer component currently provides two examples. The normal requests include: {code ...} test chrome & amp; ie & amp; mobile... A simple form submission page can be tested in chrome & ie and fails on Android phones.

Environment:

  • Thinkphp 3.2

  • Jquery 1.11.3

  • Layer-v2.1 bullet layer components

Currently, two examples are provided. The normal requests include:

$. Post ("/api/sms/send_sms.php", {phone: phone}, function (result) {if (result. status = 1) {resetCode (); // countdown} else {layer. open ({title: 'error', type: 1, skin: 'layui-layer-red', // Style Class Name closeBtn: true, // The close button is not displayed shift: 2, shadeClose: true, // enable the mask to disable content: result. msg });}});

Test chrome & ie & UC browser & change to normal

$. Post ("/index. php? M = active & a = save_info ", {phone: phone}, function (result) {if (result. status = 1) {resetCode (); // countdown} else {layer. open ({title: 'error', type: 1, skin: 'layui-layer-red', // Style Class Name closeBtn: true, // The close button is not displayed shift: 2, shadeClose: true, // enable the mask to disable content: result. msg });}});

In the mobile browser, the layer does not pop up normally.

The two are different. The major post URLs are different. The problem is very strange. Please check the front-end.

Reply content:

A simple form submission page can be tested in chrome & ie and fails on Android phones.

Environment:

  • Thinkphp 3.2

  • Jquery 1.11.3

  • Layer-v2.1 bullet layer components

Currently, two examples are provided. The normal requests include:

$. Post ("/api/sms/send_sms.php", {phone: phone}, function (result) {if (result. status = 1) {resetCode (); // countdown} else {layer. open ({title: 'error', type: 1, skin: 'layui-layer-red', // Style Class Name closeBtn: true, // The close button is not displayed shift: 2, shadeClose: true, // enable the mask to disable content: result. msg });}});

Test chrome & ie & UC browser & change to normal

$. Post ("/index. php? M = active & a = save_info ", {phone: phone}, function (result) {if (result. status = 1) {resetCode (); // countdown} else {layer. open ({title: 'error', type: 1, skin: 'layui-layer-red', // Style Class Name closeBtn: true, // The close button is not displayed shift: 2, shadeClose: true, // enable the mask to disable content: result. msg });}});

In the mobile browser, the layer does not pop up normally.

The two are different. The major post URLs are different. The problem is very strange. Please check the front-end.

Comment out the code in the function first, and directly execute alert (1) to see if both methods can be executed, and then exclude it a little bit.

Didn't I play it out or didn't I load the layer style?

Does thinkphp perform some filtering, such as verifying whether to log on or not. Recommended orconsole.log(result);Troubleshoot the problem.

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.