Added: 6 months ago
From: andrewperk
Views: 7,710
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (33)

Sign In or Sign Up now to post a comment!
  • Thanks for the awesome tut!

  • can u do one where u can send an email?

  • Thank You for your very clear presentation! Finally I could solve my problems to start learning ajax :) I want to thank You for your pronunciation and language too - english isn't my deal, but I like to listen and watch your videos.

  • Thank you for making this tutorial. Just what I needed for my current project. I have a question, is there a way of uploading files via AJAX? What I would like to do is upload an image via AJAX and then display its thumbnail on the same page as the form. I already have the image resizing part setup on the server.

  • Holy fck dude! I love your voice! Also thank you for free and so valuable knowledge!

  • Man, this is great, really helped me a lot with my current project. Both parts are great, but the raw jquery without JsHelper at the end is killer!

  • Hey @andrewperk How can I contact you ? I used the same code from your website but still this thing wont work ! When I click on the submit I am redirected to a blank page, The entries are saved in the database though ! please help !

  • @aradhyatul

    put $this->Js->writeBuffer(array('­cache' => TRUE)); in the end of form ctp file. And remove it from layout.ctp

  • Its not even showing the fadein and fadeout effect. I checked the source code and the script is generate but can't see the effects :(

  • Hey, I followed the tutorial exactly but its not working.. when I click on the submit button it refreshes and submits the data..no Ajax ! what could be the problem ?

  • @aradhyatul

    Not sure if this is the same problem that you are having but, for me, I noticed that the js buffer script was not being created on my server. Turns out the permissions for the folder /webroot/js on my server were not set to be written to and buffer script file was never being created. I changed the permissions for that folder to 777 and now the buffer script is being created and the ajax is working. Not sure if that's the best fix but worked for me.

  • A video like this is what i needed, so i really really say thank you to you. andrewperk. Thanks for your time.

  • Great tutorial. But when i click in send with the field empty it draws another form above the original form. How can i fix it?

  • Great tutorial. It really helps and accelerates my learning CakePHP

  • great tutorial ... very clear

  • Andrew, excellent tutorial! Hope to see more.

  • Most complete tutorial on the Js helper in Cakephp to update via AJAX. thanks!

    Do have a question regarding success callback. My app; success is never called. I can confirm records are being added to the db so it is successful but the call back function is never called. If I put 'success'=>$this->Js->alert('t­est') .. nothing happens. The 'complete' call back function runs though. Do you have any info on what makes a successful request or not? Maybe it will help me debug.

    cheers!

  • I had the same issue. I found that the script was not wrapped jquery document ready function, so I had to add 'onDomReady'=>TRUE to the writeBuffer method call in the default.ctp. Not sure if this the right thing to do, but it worked.

    echo $this->Js->writeBuffer(array('­cache'=>TRUE, 'onDomReady'=>TRUE));

    In the comments of the writeBuffer function it says 'If the request is an XHR(ajax) request onDomReady will be set to false. As the dom is already 'ready'. Not sure what this means exactly.

  • @zoborowi Cheers - though your fix did not resolve my problem.. after some further debugging I found that error.length was always greater than 2, on successful or unsuccessful results.. so after some head scratching, I opened my validate.ctp to find a white space on the second line. Removed it and all functions as it should.

  • @zoborowi This worked for me. Thanks!

  • Thank you! This was very helpful.

  • Wish I was young again....You are very sharp and clear in your tut's, appreciate it.

  • Thank you for putting this video. It is very much helpful to me as a newbie to cakephp.

  • got this to work. Thanks.

    I noticed that every time I reload the page, the Js helper recreates a new random .js file in app/webroot/js folder. Is there any way to remove these file in cakephp?

    Also, is there a way to disable the submit button until all of the validation criteria are met? My issue is that for some reason it's still passing the $this->Message->save($this->da­ta) 'if' statement, but it's reloading the "Could not save to database" view in the "success" div...

    Thanks

  • You are the best man! Thank you very much for this tut. Make more CakePHP tuts!

  • good tutorial

    I guess it's about the fieldList array for validation :-)

  • Nice tutorial! How could I do to update a select box after changing another one?

  • Nice tutorial Andrew

  • very helpful. i've downloaded your tutorial and i'll try your example later. thanks man. you rock.

  • thanks

    

  • In validation.js why u use $("#name").attr("id") or $("#name").val() ? You can write just $(this).attr("id") or $(this).val().

    And then you dont need dublicate your code :)

  • @unoLT Good tip, thank you.

  • @andrewperk Hi. You don't even need to use ids for the form elements. Hence reduced headache.

    Example:

    You can simply use $("input[name='name']"), $("input[name='email']") etc to access them :)

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more