database - need a button that calls a php function -
I should have a button that calls a php function to support data displayed from DB. How do i hake I just found out that because the PHP server is the side it's useless. So any help please?
This is a job for Ajax, as mentioned by others, if I can expand If you are starting, then I would like to make it easier for my life using the Javascript library. With this, your button may look like this:
& lt; Input type = "button" id = "button_foo" & gt; Button & lt; / Input & gt;
Here's how your JavaScript might look:
$ ('button_foo'). Inspection ('moushudown', function (e) {new ajax request ('handler.php', {method: 'post', onSuccess: function (t) {$ ('table_bar'). Update (t.responseText);} });}); This may seem a little challenging at first, but I think the basic JS is a learning curve when using the library. The above code, which takes the handler.PHP output, and replaces the contents of an element with "table_bar" with returned HTML. If you decide to use the prototype, docs are really helpful and easy to understand, and this is a very good book of practical press on this topic that will make you understand very quickly.
Hope that helps!
Comments
Post a Comment