i coded a saving procedure. if the saving works the user gets
redirected to a different page. if it fails he is supposed to get an
ajax-like message with jquery. now when the saving really works out,
everything goes fine. BUT:
I created a scenario to simulate a failed saving (a passed a NULL to a
database field when it is not allowed). and somehow it seems, that the
cake thrown error message is blocking my jquery. here it is.
my JS function:
--------------------------------------
function save(id)
{
$.post(installFolder + 'users/save', {
}, function(result){
var result = jQuery.parseJSON(result);
if(result.successful == false)
$.pnotify({ pnotify_title: 'Error.'});
else
window.location.href = installFolder + '/users/view/'+id;
});
}
to check if the jquery pnotify works I I set "if(result.successful ==
TRUE)" and it pops up. so jquery works here.
my controller: save()
---------------------------------
some code here....
.........................
.........................
$saving = $this->User->save($this->data);
if(!$saving)
{
$result = array("successful" => false);
}
else
{
$result = array("successful" =>
true);
$this-
>Session->setFlash('Saving successful');
}
$this->renderJSON($result);
when debugging cakes error with firebug a huge load of text appears
saying stuff like...
"uncaught exception: Invalid JSON: <pre class="cake-debug">"....
AND
"verletzt Not-Null-Constraint......." AND most importantly
" {"successful":false} "
but somehow this callback wont get to my JS-function....just nothing
happens...
hope someone can help me :) thanks a lot
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment