there are two templates i am using for view and edit(is having the form to update),
the view will contain edit(link or button), on clicking the edit button i want that the edit template should be loaded (using Ajax, without refreshing the page).
and after editing it should be redirected to view again (using ajax same as above).
is there any code or method to do that? please help me...
You can replace your whole content DIV with the result of the AJAX call. In the controller, check if the request is a XMLHTTP request. If so, only return the template without the layout around it.
So you don't change the template, you are just fetching the result of an action via AJAX.
Hava a look the documentation integrating AJAX.
You should also consider in-place editing if it'll fit into your design.
I think in-place-edit is best option here. I have used jeditable and jQuery in symfony to achieve similar functionality. Please have a look at http://myimalert.com/stock_alerts
I could not find native support for in-place-edit in Symfony 1.4.
Related
How to add AJAX code inside a Joomla article by using a third party module like Flexi Custom Code?
I have a form inside my article and want to make a submit for this form without refreshing the page.
I read some pages talking about this, but I did not understand how to.
We have written an exhaustive and easy to use guide on how to use Ajax in Joomla. You can find it here.
In short, you will need to create a function ending by "Ajax" in the module in question that will check for the submitted information and that will return an output according to the submitted information. A valid function name can be funcAjax. Just make sure you pass "func" as the "method" in the ajax URL call.
You can use free extension like sourcerer Using this plugin, you can very easily insert html and javascript codes inside article.
here is a video tutorial on how to use it. https://www.youtube.com/watch?v=LiFa1Jq8igQ
I have been working on Inline editing, with good results,
but when I saw CKEDitor I'm very impressed!
I want to create the web service for inline editing of website. Without reloading the whole page, just editable content has to be reloaded back into server.
So, I've got a page, like index.html and there is many div, some of these are editable.
I editing some content, it save it successful, but i can't fetch that record from database, because I dont know how to do this.
Please help me!
You're going to have to call the data with PHP from your database and return that via JSON and an asynchronous http request (AJAX) and update the DOM with JavaScript.
There's no easy way to say this, but you gonna have to learn how to do it, all I can do is point you in the right direction. Read up on how to use jQuery $.ajax http://api.jquery.com/jQuery.ajax/ and combine that with some PHP PDO magic http://php.net/manual/en/book.pdo.php.
I read on the web many things about creating form in jquery mobile and I didn't understand one thing. When I create a form and I would pass data through php, I hear jquery mobile serialize them and automatically pass over and if the form has been created using post method I can use them in an other page only using _POST array and nothing all. But I read also some people like it form with ajax use ajax to pass variable. So I didn't understand why use ajax?
The default for the jQuery Mobile framework is to submit forms via HTTP POST. Why? because then your web application has greater control over the UI when animating through pages, creating a smooth transition. Well, a better description can be found in the jqm docs here.
If you are looking to disable the default Ajax functionality, just append this to your form element:
data-ajax="false"
Hope this helps!
thanks for coming in and looking at my question.
I have a page that has a bunch of dynamic a tags with ids like aTag1, aTag2 ans so on.
now I need to make these tags open the same lightbox that initially loads a partial page named register.php,
and the user will fill out the form, sumbit it then go to another partial page named payment.php and go on until the registration and payment are all settled.
this process needs to be done using ajax.
I think this should be relatively easy if appropriate ajax plugin is used.
Could you please advise any plugins and tips?
Thanks a bunch!
Check out jQuery and jQuery UI Dialogs. Of particular interest to you would be the modal form demo. If you definitely need to have the content loaded from separate URLs, you could put an iframe in the dialog or do something like this example.
i am new to cakephp, and also new to ajax.
the function i trying to do is basically like this:
i am in a add page, which let me select few customer on that page.
but i wanted to set 1 more link for user, which let user click customer immediately on the add page, and the new data will show in my add page without refresh, so that the user can choose the new added customer for enter my form.
i know the idea is base on using ajax. but i am still new to it and hope any 1 can give some comment or suggestion how can i start??
the problem i face is, i am on a form, when i adding a new customer in the form, i wanted to get the new customer to show in my form without refresh. what can i do for getting this function?
thanks a lot and i will very appreciate your answer.
CakePHP has an ajax helper, which requires the prototype library. You can find the API for the AJAX helper here:
http://api.cakephp.org/class/ajax-helper
And a guide to using the helper here:
http://book.cakephp.org/view/208/AJAX
And a list of cakephp/ajax articles here:
http://bakery.cakephp.org/articles/search/tags/ajax
It's beyond the scope of a Stack Overflow answer to give you a tutorial but hopefully these links will help.
easiest way is to use a javascript library (like jquery for instance) to do an ajax request.
probably to a controller/action in your cake framework.
the easiest way would probably be returning the data in JSON and filling out your form fields.
PHP Json
jQuery AjAX/JSON