Reputation: 6146
I have two problems:
I have listed files, and when i'm clicking on one of my files the form appears, and I can derscribe my image, after click on submit button my form changes into "added" info. But I want also change title on my list, I want i.e. to appear the YES string next to the list item, which I recently added description to. How to do it?
Second problem is about refreshing form, I don't want to see the added message, just some loading gif while it's computing the database request, and when it's complete I want to see the form filled with my recently added info. How to do it?
Jsfiddle to illustrate my recent version of the script to correct: http://jsfiddle.net/GSC3x/5/
@@UPDATE TO FIRST PROBLEM:
When I have a list item like this:
<li class="files"><a href="#" class="show_hide" >filename <img align="right" src="http://artivia-dev2/git.png" alt="OK" /></a>
And when i want to change only the image here after submit the form - how to do it?
Upvotes: 0
Views: 361
Reputation: 10530
Just add the following code into your button click event.
var aLink = $(this).parents('li').children(':first');
Demo: http://jsfiddle.net/GSC3x/10/
Upvotes: 1
Reputation: 20323
upform.html("<div class='message'></div>");
so after you get response you are replacing the content of div with another content. So the initial form that you had is lost now, Instead of this send json response from your server and fill your form with server values.
To append Yes to the li like file1 Yes
sample HTML
<li><a href="#" class="show_hide" >file2</a><span></span>
sample code
jQuery(upform).parent().prev().text('Yes');
Upvotes: 2