php - Show div on successful response -
i'm trying success div show after php data sent server, updating div isn't showing.
can show me i'm going wrong. i've looked around stack overflow , tried many different solutions no luck.
<div id= "infomsg" style="display: none;">updated successfully! </div> $.ajax({ type: "post", url: "validate.php", cache: false, datatype: "json", data: datastring, success: function(success){ $('#infomsg').show(success) } }); if (isset($_post)) { $first=$_post['first']; $middle=$_post['middle']; $last=$_post['last']; $email=$_post['email']; $lives=$_post['lives']; $gender=$_post['gender']; $about=$_post['about']; $fav_track=$_post['fav_track']; $fav_bands=$_post['fav_bands']; $sql3 = "update user set first='$first',middle='$middle',last='$last',email='$email',lives='$lives',gender='$gender', about='$about', fav_track='$fav_track', fav_bands='$fav_bands' `id`='".$_session['id']."'"; $res3 = mysqli_query($mysqli,$sql3) or die(mysqli_error($mysqli)); //writes photo server if($res3) { //tells if ok echo '<div id= "infomsg" style="display: none;">updated successfully! </div>'; }else{ //gives , error if not echo "sorry, there problem updating information, contact se7ern@se7ern.co.uk ref:#1112-validate."; } }
if want show <div>
not have pass parameter in "show()
" method.
you can below mentioned approach :
<div id="infomsg" style="display: none;">updated successfully!</div> $.ajax({ type: "post", url: "validate.php", cache: false, datatype: "json", data: datastring, success: function (success) { $('#infomsg').show(); } });
Comments
Post a Comment