![]() |
fetch data in a form without using post?
let's say that i'll be making functions that should be able to execute in the page while not making use of post method...
like this.. <form> <input type = "text" name = "text" /> <input type = "button" name = "call" onclick = "<?call();"?>" /> </form> correct me if i'm wrong but is this possible... |
the onclick event is for javascript, not php. So you can't do this.
You can execute the call() function using an ajax call... |
i think that the onclick is an available option for the input type button isn't it?
|
yes but only for javascript:
input type="text" onclick="[javascriptCode]"> input type="text" onclick="alert('test')"> The above will work because it's executed on the client's machine, but the php code is parsed before the page is send to the client (on the server) so it is impossible to know when the user will click it. However you can make an ajax call: input type="text" onclick="$.get('page.php')"> And page.php will have a call to you function: <?call();"?> This will work. (The above code uses jQuery library) |
Javascript is a client side language and can be executed at any time. PHP is a server side language and is done parsing the code when you see the page. Javascript starts after PHP ends. Since they are ran at different times, you can not call PHP from javascript. What you can do is use ajax to send a request to a PHP page and get the response. I have a limited knowledge of javascript, so someone else will have to help you with that.
|
perhaps if we did this then its possible
Code:
<html xmlns="http://www.w3.org/1999/xhtml"> |
| All times are GMT. The time now is 12:11 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0