PHP read the JS variable ajax code

Source: Internet
Author: User
Tags what php
Title, online looking for a lot of code to see, see the good mess, I tried the next also did not fix. The requirements are very simple, just want to PHP from JS read a formal parameter, and do not need JS to receive what PHP return value, part of the code as follows, ask which God help write A, 3q
$device = $_post[' phone '];
function Count_num ()
{
Echo $device;
}
?>


Reply to discussion (solution)

check.php

!--? phpecho $_post[' phone '];    
However, you do not receive the check.php processing result code, cannot see

You can
$.post ("check.php", {Phone:device}, function (d) {alert (d)});
Look at

can also
file_put_contents (' test.txt ', $_post[' phone ']);
Look in Test.txt

 $device = $_post[' phone ']  ;

I thought I would be able to receive it, and the results suggested notice:undefined Index:phone. The
above PHP and JS is in the check.php file, I just want to read the JS function in PHP shownumber () The formation of that, and then according to the parameters read in the database to query the satisfied values. Just want to get a formal parameter, the return value is nothing.
you gave me the $.post ("check.php", {Phone:device}, function (d) {alert (d)}); I tried, I didn't respond.

JQ class cited No ?

  • 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.