I have a controller called User.i write three functions in that controller, ie; function1,function2,function3 each functions have corresponding view file in the View/User folder.my problem is , in my function1.ctp file i create a left menubar using jquery. there are three menus in that menubar,when i click each menu, i want to load the content of function1.ctp ,function2.ctp function3.ctp with the help of ajax request to the controler .how we can do this? is this possible..? if anybody can help me..please reply
Cakephp how to add multiple view files within a single controller using ajax
969 Views Asked by SibinF At
1
There are 1 best solutions below
Related Questions in JQUERY
- In Datatables, start value resets to 0, when column sorting
- Bootstrap modal not showing at the desired position on a web page when the screen size is smaller
- window.location.href redirects but is causing problems on the webpage
- Using JQuery Date Slider
- Storing selected language in localStorage
- How to stop other divs from still showing when i click a different button?
- Check multiple values with jQuery
- Bootstrap component does not want to render in Datatables function
- put white spaces when entering an amount moneytype symfony
- Trouble accessing custom header in AJAX response using jQuery in Fiware Keyrock
- I just cant make it work, HTML, JS and Firebase error
- Didn't declared variable still not getting any error in JavaScript
- Move element horizontally while scrolling vertically in pure JavaScript
- allow multi carousel in same page
- Embedded TikTok posts / thumbnail styling issue
Related Questions in CAKEPHP-1.3
- Return results grouped by table while transferring from php mysql to PDO_mysql drivers
- CakePHP 1.3.7 - Renaming className in Model file breaks login page
- How do I upgrade version of cakephp2.0 to cakephp3 and cakephp4 step by step?
- How to check if my Stripe account is in Test Mode?
- Cakephp1.3 with PHP 8.1
- mysql connection driver to dockerize the cakephp 1.3 application
- how do I display cakephp query result in editable form
- how do I display in a cakephp form value from orm in date format
- how do I call a public function in one controller from another controller cakephp 2.5
- How do I access a CakePHP 1.3 view via its controller such that the URL route conforms to application/controller/view
- How do I solve HTTP Error 500.0 - Internal Server Error
- How do I solve Cake is NOT able to connect to the database on IIS Server running CakePHP 1.3.17
- How do I resolve Cannot use 'Object' as class name as it is reserved in C:\projectfolder\ckphp-demo\cake\libs\object.php on line 33
- Multi input values using foreach and calculating values
- headermap cache got stuck?
Related Questions in CAKEPHP-AJAXHELPER
- CakePHP 3 : Retrieving data from database using Ajax
- CakePHP Ajax : update list with change in related list
- Referencing Scripts.Render("~/bundles/jqueryval") twice will force the Ajax.BeginForm to send two post requests when submitting my partial view
- Ajax to load content of another php page
- Cakephp how to add multiple view files within a single controller using ajax
- why jquery code echoed from php into another page using ajax is not working?
- Ajax request in cakephp 2.x
- Cakephp ajax update validation w3c
- Ajax Contact Us Form Validation - Cakephp 2.0
- CakePHP, Helper class AjaxHelper could not be found
- Cakephp 2.1 - AjaxHelper
- cakephp ajaxhelper using jquery with multiple buttons
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Of course it is possible - AJAX defines it as possible.
If you already have the three functions set-up and see them rendering their views when you go to
example.com/yourcontroller/functionNamethen you're almost tehre.What you need to do now on the client side is when a user clicks on a main-menu - load the submenu, right? Well attach a javascript click function callback to the clicked HTML item and when that event occurs call the server via AJAX.
You will need to ask yourself "What do I need to return from the server - HTML or JSON?" In the first case - when you receive the HTML data back just put it in the DOM where you want it to be. In the second case you will need to process the JSON and build HTML or whatever.
This was the answer, now some advice.
Do you absolutely really, really need to use AJAX for menus? Do they change that often?
Remember: 1 AJAX call == 1 request to the server Are your sub-menus really that data/change intensive that you need to load them like this? If your menus change based on the user's location (in the site) or user actions for example, ok you can use this, but otherwise you're killing a mosquito with a bazooka! You should try to keep the data exchange as low as possible, gzip the server returns, etc. etc. This solution could be an overkill for this situation.