cppit
cppit

Reputation: 4564

Refresh a div inside a PHP file using jQuery or JavaScript and Ajax

I have a div displayed in the manner you see on the code and I need it to be refreshed everytime someone click on one of the links:

$str.= "<div id='foldersdiv'>";

  foreach ($folderslist as &$value) {
  $str.= " <a href=\"#1\" onClick=\"change_status_sp('{$spDetails->sp_id}','".$valu."');\">".$value['items']."</a>";

}
}    // loop ends

  $str.= "</div>";

Upvotes: 0

Views: 478

Answers (1)

Bradmage
Bradmage

Reputation: 1231

Very basic example. This will get you started. But I'd look into the .ajax function. It has heaps of options.

function change_status_sp(id)
{
    $('#foldersdiv').load('ajax/list.php?id='+id, function() {
        alert('Load was performed.');
    });
}

jQuery Load

Upvotes: 1

Related Questions