The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
PHP Function Call from JavaScript
Hello everyone,
I have a JavaScript at forumroot\clientscript\myjavascript.js I have a PHP File at forumroot\includes\functions_myfunctions.php Into functions_myfunctions.php there are one function named mytestfunction. How i Call/Run mytestfunction from the JavaScript ? |
#2
|
|||
|
|||
If I understand you correctly you can't, at least not directly, because the php runs on the server before the page is sent to the browser, and the javascript runs in the browser after it's received. But there may be a way to do what you want to do, either write javascript into the output page to do it or else make a background ('AJAX') call to the server to do it.
|
#3
|
||||
|
||||
Quote:
can you explain little more who can i do that things ? Can YOU HELP ME DO IT WITH AJAX??? |
#4
|
|||
|
|||
Hmmm...well, it's documented out there so I won't try to repeat all the details (which I'd have to look up anyway). I think probably the best thing would be to find an example. One I ran across recently is the Cyb Chatbox mod (https://vborg.vbsupport.ru/showthrea...ht=cyb+chatbox), it makes a background request to update the messages and uses a plugin on the misc_start hook. There's no magic on the server, it's just a normal http request. Sorry I'm not more help, but if you run in to problems you can post them here.
I just read your other thread - if you know the text you want to insert when the button is pressed, then it would probably be much easier to write it in to the page output as a javascript string and do something like Lynne suggested. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|