-
30 Nov 2012 1:54 AM #1
Answered: Ok, so I'm a n00b. MVC and PHP backend problems
Answered: Ok, so I'm a n00b. MVC and PHP backend problems
Hello everyone,
As usual there is probably a simple answer to my problems, but I've been going around in circles.
Here goes :
I have a view in ExtJs with a simple button. In the handler function, I would like to call a function from my PHP backend (DocumentController.php class).
Now, I absolutely need to call a PHP function as I wish to download a document on the click of the button.
So what do I need to do in my handler function to call an DocumentController object ? Or do I have to call a plain PHP 4 page ?
Is there an equivalent to :Thanks for your helpPHP Code:DocumentController myController = new DocumentController();
myController.downloadDocument();

-
Best Answer Posted by existdissolve
The easiest and quickest way to return results to your ExtJS app is to make an AJAX request to a remotely-accessible url in your PHP app that is configured to return data in a format that ExtJS can make use of (e.g., JSON, XML, etc.).
For downloading files, you'll probably want to simply open up a new window with a url to a page in your PHP app that can manage serving up the file with the appropriate headers, content type, etc.
-
1 Dec 2012 2:02 PM #2
The easiest and quickest way to return results to your ExtJS app is to make an AJAX request to a remotely-accessible url in your PHP app that is configured to return data in a format that ExtJS can make use of (e.g., JSON, XML, etc.).
For downloading files, you'll probably want to simply open up a new window with a url to a page in your PHP app that can manage serving up the file with the appropriate headers, content type, etc.


Reply With Quote