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.
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 !
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 ?
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.
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('test') .. 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.
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.
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.
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->data) 'if' statement, but it's reloading the "Could not save to database" view in the "success" div...
Thanks for the awesome tut!
nxttmac 2 weeks ago
can u do one where u can send an email?
Carlitta87 4 weeks ago
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.
PasiKimmo 1 month ago
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.
gojnik 1 month ago
Holy fck dude! I love your voice! Also thank you for free and so valuable knowledge!
Mapciooo 1 month ago
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!
aoporanu 1 month ago
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 2 months ago
@aradhyatul
put $this->Js->writeBuffer(array('cache' => TRUE)); in the end of form ctp file. And remove it from layout.ctp
faizan101010 1 month ago
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 :(
aradhyatul 2 months ago
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 2 months ago
@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.
tonylisanti 1 month ago
A video like this is what i needed, so i really really say thank you to you. andrewperk. Thanks for your time.
BlakMetall 2 months ago
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?
fenix32 2 months ago
Great tutorial. It really helps and accelerates my learning CakePHP
sonbemi 2 months ago
great tutorial ... very clear
lenovocaren 3 months ago
Andrew, excellent tutorial! Hope to see more.
jameslcasey1 3 months ago
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('test') .. 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!
slappy457 4 months ago
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 4 months ago 2
@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.
slappy457 4 months ago in playlist Liked
@zoborowi This worked for me. Thanks!
yasminsmells2 3 weeks ago
Thank you! This was very helpful.
JoeyHauschildt 4 months ago
Wish I was young again....You are very sharp and clear in your tut's, appreciate it.
gottalikeit2010 4 months ago
Thank you for putting this video. It is very much helpful to me as a newbie to cakephp.
d0ngix 5 months ago
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->data) 'if' statement, but it's reloading the "Could not save to database" view in the "success" div...
Thanks
benkjm 5 months ago
You are the best man! Thank you very much for this tut. Make more CakePHP tuts!
xtiam57 5 months ago
good tutorial
I guess it's about the fieldList array for validation :-)
KOmaSHOOTER 6 months ago
Nice tutorial! How could I do to update a select box after changing another one?
eliconesa 6 months ago
Nice tutorial Andrew
ucha19871 6 months ago
very helpful. i've downloaded your tutorial and i'll try your example later. thanks man. you rock.
theredfont 6 months ago
thanks
gunarsekaran 6 months ago
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 6 months ago 3
@unoLT Good tip, thank you.
andrewperk 6 months ago
@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 :)
umnuscom 1 week ago