NeverEndingFlashStories
asked on
Updating PHP populated table using ajax
Hi,
I have a page that has an collapsible accordion layout.
In accordion section B, the following PHP code is invoked :
showUserCourseModules() basically creates a table id='uniqueTable' on the fly, by querying a database.
In accordion section A, I have a form that allows user to add entries to the database using ajax.
The function looks somewhat like this :
How should i actually attempt to do this? I think the reason why it isnt working is because basically i have an ajax jquery code that is trying to request a table created using php to refresh. But there must be a way to do this?
Thanks for help.
I have a page that has an collapsible accordion layout.
In accordion section B, the following PHP code is invoked :
<article>
<?php showUserCourseModules();?>
</article>
showUserCourseModules() basically creates a table id='uniqueTable' on the fly, by querying a database.
In accordion section A, I have a form that allows user to add entries to the database using ajax.
The function looks somewhat like this :
function addnew() {
var scriptURL="addModule.php?moduleCodeInput="+moduleCode;
$.ajax({
url:scriptURL,
success: function(textStatus){
resultone = textStatus;
if (resultone == 1){
DO SOMETHING
}
else if (resultone == 2){
document.getElementById().refresh("uniqueTable"); <---- THIS DOESNT WORK.
}
else if (resultone == 3){
location.reload(); <---------------------THIS WORKS, but refreshes the whole page
}
and so on
How should i actually attempt to do this? I think the reason why it isnt working is because basically i have an ajax jquery code that is trying to request a table created using php to refresh. But there must be a way to do this?
Thanks for help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You are most welcome - good luck with it.
ASKER