Hi Marc, Each `dispatch-rules` rule takes a keyword option for which methods you want it to handle, the default being no method and "get". So your call is equivalent to
[("test-ajax") #:method "get" ajax] but you want [("test-ajax") #:method "put" ajax] This facilitates more easily having different functions for different methods. Jay On Sat, Feb 27, 2016 at 1:03 PM, Marc Kaufmann <marc.kaufman...@gmail.com> wrote: > Hi all, > > I perform the following call in jQuery in a page: > > $.post( "test-ajax", > function( data ) { > alert( "Data Loaded: " + data); > }); > > > The test-ajax page gets called via the url-dispatcher: > > (define-values (site-dispatch site-url) > (dispatch-rules > ... > [("test-ajax") ajax])) > > and the ajax function is simply this: > > (define (ajax req) > (response/xexpr > "1 ")) > > Nonetheless, the above Ajax call fails with a 404 error, but when I replace > $.post by $.get, it works. As far as I can tell, the only thing about the > request this changes it the method, from POST to GET. > > Is there a reason this fails? Do I need to tell the webserver that it should > serve both POST and GET? > > Btw, the reason I want to use post is that when I use get, the data I send > with the request gets put at the end of the url (../test-ajax?some-binding) > and I couldn't figure out how to have the dispatcher deal with this problem > (that returned an error 500). > > Thanks, > > Marc > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- Jay McCarthy Associate Professor PLT @ CS @ UMass Lowell http://jeapostrophe.github.io "Wherefore, be not weary in well-doing, for ye are laying the foundation of a great work. And out of small things proceedeth that which is great." - D&C 64:33 -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.