playframework 2.1 - play framwork JsRoutes ajax form submit -


im trying submit form via jsroutes , ajax , dont think im getting controller ....

this routes

post   /submit    controllers.application.submit() 

and jsrouts function:

$('#submit').click(function() { jsroutes.controllers.application.submit().ajax({ data : $("#contact-form").serialize(), url: '@{application.submit()}',  success : function(data) {     alert("succsses");   }, error : function(err) {     alert("error");  }   });  }); 

this im sendig server

 http://localhost:9000/?name=ajax&lastname=aaa&email=miko5054%40hotmail.com&phone=453534  

what im doing wrong here ???

the @{application.submit()} code incorrect. should @{routes.application.submit()}.

but if use javascript router jsroutes.controllers.application.submit(), don't need specify url inside ajax() call. can remove url:... line , should work fine.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -