开发者

passing an javascript object from cakephp view to controller

I am developing a website using cakephp, and I'd like to pass a javascript object in view back to the controller. I know that using a form could be easier bu开发者_StackOverflow社区t I need to do this customized.

So here's the object ('annotation' and 'article_id' are real column names in the database, annotation and article_id are both variables containing data):

var postdata = {
    'annotation' : annotation,
    'article_id' : article_id
};

What method in the view should I use? Is it .post?

And how should I program the corresponding controller to correctly receive the object and extract data from it?


You probably want to do an ajax request.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜