0

I have a View block. I can print the content with views_embed_view function, passing $display_id, contextual filter, etc.

Now I want the user to click on a point in an image, and with Javascript, show the block in a div. So when the user click on different coordinates of the image, I show different product details in that div.

This should be possible to accomplish using Ajax ( $(#div-id).html() or div_id.innerHTML ), but my limited experience with Ajax is to retrieve a JSON formated data, not a full HTML block of a View.

How could I get it working? Is it possible at all?

0

I have finally solved it, by using the following code which goes in a custom module. The problem I had was that it was not rendering anything as there were nested divs. If you play with styles or add some HTML between divs, it will show the data.

The code is available at http://www.seanbuscay.com/ajax-reader-demo/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.