NationGamer Posted July 12, 2012 Posted July 12, 2012 Hello i have a problem with jquery ive made a modification and uses jquery for posting data to the server and returns data to user side if successful but the problem im having on he page i have values and after i post data to the db with jquery the values on the page dont change how can i make them dynamically change Example: Username: Admin then say i change username to demo u have to refresh the page for the username to change so will be stuck saying admin when username is demo now is there anyway to dynamically update that value with jquery without refreshing the page thanks. Quote
Danny696 Posted July 12, 2012 Posted July 12, 2012 Make sure the code for the user name (used the same example as you) is something like: Username: <div id="usernameid">$ir['username']</div> Then when they change there name, it will be something like: var newname = $("#newnameinputid").val() $("#usernameid).val(newname) This isn't tested, and was done on my iPad, so it may not work strait away, but it is a starting point. Quote
HauntedDawg Posted July 12, 2012 Posted July 12, 2012 for html element's, to get the inner html content, you use $.html() like so: var name = $('#elementID').html(); $('#placementID').val(name); //IF ITS A INPUT FIELD $('#placementID').html(name); //IF ITS AN HTML ELEMENT 1 Quote
NationGamer Posted July 13, 2012 Author Posted July 13, 2012 thanks for this sorted my problem out Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.