Expand my Community achievements bar.

SOLVED

CQ.HTTP.post()

Avatar

Level 4

Hi masters!

Do you have any reference, example, tutorial... about using CQ.HTTP.post() to get server data from the browser? I would like to use it to call to /bin/querybuilder. I've done it using JQuery ajax() method, but I suspect that CQ.HTTP.post() will be more 'elegant' solution...

I've checked the official documentation [1], but there's no example...

Thank you very much!

Regards,

Julio.

[1] http://dev.day.com/docs/en/cq/current/widgets-api/?class=CQ.HTTP

1 Accepted Solution

Avatar

Correct answer by
Level 10

CQ.HTTP.post is just another way to do the same thing as AJAX. You can post data using AJAX and i would not say that it's less elegant. AJAX is a standard web technology.  

We have examples of using AJAX to post data from a CQ page to a CQ sling servlet.

You can also post data to CQ using Sling Post Servlets.  

However - having said that -- CQ.HTTP.post is part of CQ and there should be an example of how to use it. I will work with the doc team to make this happen. 

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

CQ.HTTP.post is just another way to do the same thing as AJAX. You can post data using AJAX and i would not say that it's less elegant. AJAX is a standard web technology.  

We have examples of using AJAX to post data from a CQ page to a CQ sling servlet.

You can also post data to CQ using Sling Post Servlets.  

However - having said that -- CQ.HTTP.post is part of CQ and there should be an example of how to use it. I will work with the doc team to make this happen. 

Avatar

Level 4

Thank you smacdonald2008!

I agree on almost everything you say, but I would like to compare myself both of them. And it's a good opportunity to learn one more thing! smiley

I'll be waiting, and searching, for any update on this documentation.

Best regards!

Avatar

Level 10

We added this to our list to base a CQ dev community article on. Once done - I will update this thread with the link to the community article. 

Avatar

Level 4

Thank you very much! I'll be waiting for news!

Best regards,

J.