user2361114 user2361114 - 6 months ago 38
Ajax Question

Calling another ajax function on ajax success

I'm calling an ajax function for user login.
After successful login, I want to refresh a div with content like (Ex. Welcome Mr. User, logout).


<ul id="signup">

<ul id="loginbox">
<li><label>Enter email address</label><br/><input type="text" class="bookinginput" id="uemail"></li>
<li><label>Enter password</label><br/><input type="password" class="bookinginput" style="width: 151px;" id="upassword">
<button class="styled-button-8" style="margin-top: -43px;margin-left: 10px;" onClick="ulogin()">Login</button>


function ulogin()
var uemail = $('#uemail').val();
var upassword = $('#upassword').val();
type: "POST",
url: "udoologin.php",
data: {email:uemail, password:upassword}
}).done(function( result ) {

After successful login, I'm able to change div#loginbox with successfull login message, but I want to replace another div#signup also with

<ul id="signup">
<li>Welcome <?php echo $user?></li>

How can I achieve this?

Answer Source

In PHP when u are printing the result,echo

<li>Welcome <?php echo $user?></li>

joined with a seperator like '|||' or something.

in jquery

done(function( result ) {
 var log=result.split('|||');


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download