I have spring contoler which talking json like :
@RequestMapping(value = "/todos/delete", method = RequestMethod.POST)
public String deleteTodo(@RequestBody Todo todo, Model model) {
logger.info("/todos/delete : todo = " + todo);
String status = "ok";
int num = 0;
try {
int id = todo.getId();
num = todoMapper.deleteByPrimaryKey(id);
} catch (Exception e) {
logger.error("/todos/delete failed : " + e);
status = "fail";
}
// result
model.addAttribute("out", "deleted " + num + " todo(s)");
model.addAttribute("status", status);
return jsonTemplate;
}
With curl , I can post it like:
curl -H "Content-Type: application/json" -X POST -d "{\"id\":1}"
http://localhost:8080/todo/todos/delete
Then I can get todo initialized.
But if I post with JulianBirch/cljs-ajax :
(ajax/POST "/todo/todos/delete"
{:format :json
:response-format :json
:handler #(dispatch [:handle-del-resp %1])
:error-handler #(dispatch [:handle-error %1])
:params {"id" id}})
I am getting todo return null.
Any point will be appreciated, thanks in advanced!
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.