Hi

I think I've found the reason why it doesn't works. There is a patch in the "devel" branch. I need to add more tests, if everything works as expected, it will be released really soon.


On Sat, Aug 21, 2010 at 3:23 PM, P Kishor <punk.kish@gmail.com> wrote:
I can't figure out how the ajax method works. In my JavaScript (with
jQuery), I have

   $.ajax({
       beforeSend: function(xhr){
           xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
       },
       url: '/model/' + model_id,
       dataType: "json",
       success: function(data) {

           // do something with
       }
   });

and, in my App.pm, I have

   ajax '/model/:model_id' => sub {
       my $result = do something with model_id
       return to_json($result);
   }

however, the above doesn't work at all. I get a 404. If I change the
ajax method to

   get '/model/:model_id' => sub {}

then it works fine. Which brings me to the question -- what is this
ajax method supposed to do better than get or post? And, why doesn't
it work for me?



--
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
-----------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
=======================================================================
_______________________________________________
Dancer-users mailing list
Dancer-users@perldancer.org
http://www.backup-manager.org/cgi-bin/listinfo/dancer-users