Jquery load enables users to display login status in real time on HTML pages

Source: Internet
Author: User
Tags html page

This piece is in the statement page div We specify the ID can be

The code is as follows Copy Code

<div id= "Ajaxlogin" >

</div>

Now let's do a dynamic ajaxlogin.php to determine if the user is logged in

ajaxlogin.php

The code is as follows Copy Code

?
Session_Start ();
if ($_session[' u_login ']== ' Turelogin ')
{
Echo ' Here shows what you want to display in the Ajaxlogin in the HTML page ';
}
Else
{
Echo ' Displays a message that is not logged in the Ajaxlogin div ';
}

?>


Okay now HTML page and PHP are done we use jquery+ajax/"target=" _blank ">jquery Ajax in the load to instance,

The code is as follows Copy Code


<script src= "/js/v2/jquery-1.7.2.min.js" language= "JavaScript" type= "Text/javascript" ></script>

<script>
$ (' #ajaxlogin '). Load (' ajaxlogin.php?a= ' +math.random ());
</script>

Put on the back of your ajaxlogin can be, do not put in Ajaxlogin before Oh, otherwise it will fail to load, so that our HTML page real-time login information is completed.

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.