I have a online photo gallery and when you hover over a image an edit button appears that opens up a jquery prompt box in which you enter the caption after this has been entered i have the following code

var caption=prompt("Please enter new caption"," ");
    if (caption!=null)
    var link = "?id="+ $(this).parents('.thumbnail').attr('id') + "&c=" + caption;


This should refresh the div but it wont it flashes but the PHP caption that comes from the database wont change even tho the script at photo_c.html is changing it and working, i have been informed to change it to this

var caption = prompt("Please enter new caption", " ");
if (caption != null) {
    var link = "?id=" + $(this).parents('.thumbnail').attr('id') + "&c=" + caption;
    $.post("../photo_c.html" + link,function(){

But that refreshes div but only shows the caption that was entered not the actual data that belongs in the div the content is

<ul class="thumbnails gallery" id="loaddiv">
$get_all_pics = mysql_query("SELECT * FROM gallery_photos");
while ($photos = mysql_fetch_array($get_all_pics)) {
 '<li id="'.$photos['photo_id'].'" class="thumbnail">
    <a data-rel="popover" data-content="'.$photos['photo_caption'].'" style="background:url(/images/'.$photos['photo_filename'].')" title="Caption" href="/images/'.$photos['photo_filename'].'"><img class="grayscale" src="/images/'.$photos['photo_filename'].'" alt="'.$photos['photo_caption'].'"></a>

as you can see i need to update the captions that show on the images by refreshing the div -

Any help would be greatly appricated

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.