How to: refresh div on page load, append element to div, change image on click

How to: refresh div on page load, append element to div, change image on click

Hello,

I have questions related to three operations using jQuery:
  1. refresh a div element on page load
  2. append an element on top of the other elements in div
  3. change an image (pending/accepted) from the div's elements
I know that there are tutorials for that, but i am so short in time. I just finished my PHP courses, and i am too tired to get into the jQuery magic right now.

Here is the situation that i am confronting. I have to files: propune.php (which is basically the page that has the form and the div that should be refreshed/appended) and propuneri.php (the file that is handling ajax calls).

propune.php (partial) http://pastebin.com/SFJ7zSRJ
propuneri.php (partial) http://pastebin.com/E11Z7DUn

I started to work on img update function (pending/accepded), but i noticed that the update function is not working fine, and also the refresh function... I was reading info from jQuery API, but i did not have the time to read even an introduction to jQuery, so I KNOW that i am doing alot wrong here, but please, can you help me?

Here is the example of the form that i am using.




This is how the things should work:

On the text field user is pasting a youtube link. The videoID is recorded to database, and the user's avatar, along with the song's title and the state of the links (pending, by default), is appended to the top of the list. If an admin is clicking on the link's state image, it is switched without reloading the page.

On page load the list is refreshed.

On refresh button click, the list is refreshed.

Please help me. I should get this thing going by Friday morning, so i am kind of desperate.

Thank you verry much.