开发者

Display records from a database and then when a new one is added automatically update the displayed records from the database with the new one

I'm trying to display records from a database and then when a new one is added automatically update the displayed records from the database with the new one

I am doing this using php and javascript. I want to load a page and display tags under a video and then when a user adds a new tag by entering it into text box to add it to the 开发者_如何学运维database and then refresh the part of the page which shows these tags and include the new one which has just been added all without the page being reloaded.


You will need to use Ajax and Javascript or a Javascript Framework like JQuery or Prototype to create HTML DOM Elements dynamically and show them to the user after the Ajax call returns the result.

UPDATE:

For JQuery + Ajax

--- Learning jQuery: 11 excellent resources

--- Simplify Ajax development with jQuery

--- Use jQuery and PHP to build an Ajax-driven Web page

For Example to create a HTML DOM Element in JQuery

var myLink = $("<a />");

//Add a link to it
myLink.attr('href', 'http://localhost/index.php');
//Add a text
myLink.text('Go Here');

//Add it to a div of id "myDiv"
$("#myDiv").append(myLink);

I hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜