|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
How to pass PHP variable value to jquery function? Hello to all, I am last year Computer Science student. As a part of my syllabus I am working on one live project. In one of my of my page I have checkboxes and if it's status change, then I have to update some sql table. To do this I have to pass PHP variable value to jquery function. I tried various method, but none of them worked out. Can anyone tell me how to pass PHP variable value to jquery function? Please help me. Thank you. |
#2
| |||
| |||
Re: How to pass PHP variable value to jquery function? You can pass PHP variable value to jquery function using following code. In the following code I have use create three variable to store name of Author, Keywords and Description. In the following code I have use one SQL query to accept data from the database. PHP Code: |
#3
| |||
| |||
Re: How to pass PHP variable value to jquery function? As per my information you have to use metadata plugin to pass PHP variable value to jquery function. First you have to use the metadata plugin in your code and after that you have to split the variable name in my html. If you don't know how to do this then use following code. Code: <a href="links/tos/" classs="{myVars: mysValues}">hellos</a> |
#4
| |||
| |||
Re: How to pass PHP variable value to jquery function? I think you have to first catch PHP variable from inside jQuery. If you don't understand then use following code. Code: $.get("scripts/buttons1.php", {}, functions(datas){ datas = splits(':'); }); Code: echo("$vars1:$vars2:$vars3"); |
#5
| |||
| |||
Re: How to pass PHP variable value to jquery function? If you are tried to get variables from a PHP script into javascript, which is running on another page, then in this case you have to use ajax. First convert your PHP script to XML and after that use $.ajax for getting data from script outputs. You have to write following code to do this. Code: <script types="texts/javascripts"> vars mysPhpsVars = <?php echos ($mysVars); ?>; </script> |
#6
| |||
| |||
Re: How to pass PHP variable value to jquery function? As per my information PHP runs on the server and jQuery runs on the client. For this reason you are not able to pass a PHP variable to a jQuery function. To overcome this problem you have to use onchange callback: Code: <input types='checkboxs1' names='lidas' values='mensagems_ids' onchanges='mys_functions( <?php $mensagems_ids = "3"; echo $mensagems_ids; ?> )'/> Code: $('#myinputids').changes(function(s) { }); |
![]() |
|
Tags: class, file handle, function, main, object, php |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to Pass a Javascript variable to a PHP script | leshaspar | Software Development | 4 | 24-11-2010 10:48 AM |
Call a function depending on the variable name | Captain Carrot | Software Development | 5 | 23-03-2010 09:27 AM |
How to pass function with parameters to another function in PHP? | Linoo | Software Development | 5 | 27-02-2010 07:52 PM |
Overloading an operator to pass different variable | Flaco | Software Development | 3 | 25-12-2009 11:27 AM |
Accessing a variable outside a function without arg | BoanHed | Software Development | 3 | 04-12-2009 01:35 PM |