First, whatever comes back from the server in an AJAX request will only be available in request.responseText, so you'll have to alert() that instead of 'saved'.
Second, the URL is exactly the same as for any other URL and any link on the page, it's relative to the current page, absolute from the server root (/controller/action) or "absolute absolute" (http://....). I generally use the $html->url() function to get the URL for the right controller/action and echo that into the JS. Chrs, Dav On 12 Sep 2008, at 15:43, rocket wrote: > > Well I have > > ------------------- > controller > ------------------ > function hide() { > echo "hello"; > } > > --------------- > jquery > --------------- > $("a.hide").click(function() { > $.post('hide', {}, function() { > alert('saved.'); > }); > return false; > } > > > but when I click the link it doesn't output "hello". the alert shows > but nothing outputs. > > any thoughts =/? > > ALSO does anyone know if the post URL parameter can be a full http:// > link? > > > On Sep 12, 2:23 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: >> "Executing" a controller action is just doing a page request. >> If you type /myapp/controller/hide into the browser, >> Controller::hide() will be executed. >> If you do an AJAX request to /myapp/controller/hide, >> Controller::hide() will be executed just the same. >> >> Where's the problem? :-3 >> >> On 12 Sep 2008, at 14:56, rocket wrote: >> >> >> >>> ok i've been looking online for several hours now and can't find >>> anything, so here i am! >> >>> basically I have an announcment div (#announcement) that I show on >>> my >>> page. The user can click a text link, "don't show" and I want it to >>> slideUp, then save their setting (in a DB). >> >>> My problem is accessing the controller to get into the db. I can't >>> figure out how to send a request to the controller to save the item. >> >>> In the best world, when they click "Don't Show" the textbox will >>> slideUp, it will execute my hide() controller action, and still be >>> on >>> the same page. >> >>> Can anyone give me some guidance at all? > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---