# Can I use doPost to send data through the WebDev module pocess it and see the page in an iframe in Perspective

**URL:** <https://forum.inductiveautomation.com/t/can-i-use-dopost-to-send-data-through-the-webdev-module-pocess-it-and-see-the-page-in-an-iframe-in-perspective/86459>\
**Category:** Ignition\
**Tags:** python, ignition81, perspective, scripting, vision\
**Created:** [February 27, 2024, 9:07pm UTC](https://forum.inductiveautomation.com/t/can-i-use-dopost-to-send-data-through-the-webdev-module-pocess-it-and-see-the-page-in-an-iframe-in-perspective/86459 "2024-02-27T21:07:21Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![milbar](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@milbar](https://forum.inductiveautomation.com/u/milbar)\
**Post date:** [February 27, 2024, 9:07pm UTC](https://forum.inductiveautomation.com/t/can-i-use-dopost-to-send-data-through-the-webdev-module-pocess-it-and-see-the-page-in-an-iframe-in-perspective/86459/1 "2024-02-27T21:07:21Z")

</div>

I have set up a Perspective view that has a button that runs a script to perform a query and then send it to a Python WebDev resource that consists of a script that pulls the data out of the body, processes, builds the html for a JavaScript SVG chart.

I would to like view this on the same view as the button. I have successfully sent the data to the endpoint and returned the dataset to the console. Also the html comes back.

However, nothing is drawing in the iframe.

I tested just a static version of the same html in a doGet to the same endpoint and the chart is drawing.

I have not tried to pass the dataset in the url to a doGet because I am worried about the size limits of data passed in a url

Does anyone know if the iframe will render the html code in this way?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [February 27, 2024, 9:13pm UTC](https://forum.inductiveautomation.com/t/can-i-use-dopost-to-send-data-through-the-webdev-module-pocess-it-and-see-the-page-in-an-iframe-in-perspective/86459/2 "2024-02-27T21:13:39Z")

</div>

Any script you run will be issued from the gateway, not your running session, so the updated HTML returned by your Webdev endpoint is just going to end up lost.  
Could you have your Webdev endpoint return an image file or SVG, and use that directly in an image in your view, instead of using the iframe?

This is going to be a tricky thing to accomplish within your constraints.

---

<div class="post-metadata">

**Author:** ![milbar](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@milbar](https://forum.inductiveautomation.com/u/milbar)\
**Post date:** [February 27, 2024, 9:16pm UTC](https://forum.inductiveautomation.com/t/can-i-use-dopost-to-send-data-through-the-webdev-module-pocess-it-and-see-the-page-in-an-iframe-in-perspective/86459/3 "2024-02-27T21:16:42Z")

</div>

That will prob work and I want to turn this in to an image for a report at some point.

Is there a lib or something I can use in the WebDev resource script to turn this html in to an image?

I am doing beacuse of the limitations of not running javascript directly in ignition.

---

<div class="post-metadata">

**Author:** ![milbar](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@milbar](https://forum.inductiveautomation.com/u/milbar)\
**Post date:** [February 27, 2024, 9:20pm UTC](https://forum.inductiveautomation.com/t/can-i-use-dopost-to-send-data-through-the-webdev-module-pocess-it-and-see-the-page-in-an-iframe-in-perspective/86459/4 "2024-02-27T21:20:40Z")

</div>

![Screenshot 2024-02-27 at 3.18.47 PM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/1/715c74f99322fc1e591ee32ad39df02c0f89f615.jpeg)

This is what is drawn by the html code. The colored lines are currently sample generated data which will eventualy be the data passed in the query.

---

<div class="post-metadata">

**Author:** ![milbar](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@milbar](https://forum.inductiveautomation.com/u/milbar)\
**Post date:** [February 28, 2024, 3:22am UTC](https://forum.inductiveautomation.com/t/can-i-use-dopost-to-send-data-through-the-webdev-module-pocess-it-and-see-the-page-in-an-iframe-in-perspective/86459/5 "2024-02-28T03:22:35Z")

</div>

Would Apache Batik work for this?

Would I put the jar files in the lib/core/common folder?

Do they need to all be in a folder under this folder or just individual jars?

Would I need to use the pack200 tool?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 28, 2024, 12:14pm UTC](https://forum.inductiveautomation.com/t/can-i-use-dopost-to-send-data-through-the-webdev-module-pocess-it-and-see-the-page-in-an-iframe-in-perspective/86459/6 "2024-02-28T12:14:12Z")

</div>

> [@milbar](#):
>
> Batik work for this?

Only in Vision.

I have a module that packages the libraries for Vision Clients (with a component wrapper). The designer already has all the libraries.

> **[Ignition Third-Party Module Showcase](https://inductiveautomation.com/moduleshowcase/module/automation-professionals-llc-batik-scalable-vector-graphics-canvas)**
>
> Easily extend Ignition's core functionality with Third-Party Modules. The Module Showcase is a great place to find a solution that best meets your needs.

---

<div class="post-metadata">

**Author:** ![milbar](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@milbar](https://forum.inductiveautomation.com/u/milbar)\
**Post date:** [February 28, 2024, 12:55pm UTC](https://forum.inductiveautomation.com/t/can-i-use-dopost-to-send-data-through-the-webdev-module-pocess-it-and-see-the-page-in-an-iframe-in-perspective/86459/7 "2024-02-28T12:55:57Z")

</div>

I would prefer that I was able to send the data to WebDev and have it send the html back and have it rendered directly in an iframe in Perspective but it seems that’s not possible.

So the next option seems to be a solution that will return the chart as an image to a perspective page.

I saw your module and that it was designed for Vision.

What prevents me from having batik or some other java taking the svg content in the doPost endpoint and returning it to an image container in Perspective?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 28, 2024, 1:03pm UTC](https://forum.inductiveautomation.com/t/can-i-use-dopost-to-send-data-through-the-webdev-module-pocess-it-and-see-the-page-in-an-iframe-in-perspective/86459/8 "2024-02-28T13:03:44Z")

</div>

If you don't need to manipulate it, I don't see why WebDev cannot do this. You will need two endpoints:

- One to receive the post with the SVG. This would cache the content somewhere. I'd recommend a [sessionVarMap](https://www.automation-pros.com/toolkit/doc/scripting.html#sessionvarmap), targeting the Perspective session that wants this image. Or in a database. Then message or otherwise trigger a event in the session to display an IFrame or Image component with the URL for:

- The endpoint that retrieves the SVG and serves it.

---

<div class="post-metadata">

**Author:** ![milbar](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@milbar](https://forum.inductiveautomation.com/u/milbar)\
**Post date:** [February 28, 2024, 3:16pm UTC](https://forum.inductiveautomation.com/t/can-i-use-dopost-to-send-data-through-the-webdev-module-pocess-it-and-see-the-page-in-an-iframe-in-perspective/86459/9 "2024-02-28T15:16:19Z")

</div>

@pturmel Thanks for the reply.

In this senerio do I need to install Batik?

If yes, can you answer any of the initial questions I had.

I have the endpoint set up to recieve the post and I have it echoing the JSON data and the static html back currently.

Can you give me a bit of direction on the sessionVarMap?

> [@pturmel](#):
>
> - The endpoint that retrieves the SVG and serves it.

Also, Would this be another WebDev endpoint?  
If yes, Would I set up a doGet in an iframe to get this?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 28, 2024, 3:46pm UTC](https://forum.inductiveautomation.com/t/can-i-use-dopost-to-send-data-through-the-webdev-module-pocess-it-and-see-the-page-in-an-iframe-in-perspective/86459/10 "2024-02-28T15:46:46Z")

</div>

> [@milbar](#):
>
> install Batik?

No.

> [@milbar](#):
>
> direction on the sessionVarMap

If it doesn't make sense, just use a database.

> [@milbar](#):
>
> another WebDev endpoint?

Yes.

> [@milbar](#):
>
> a doGet in an iframe to get this?

If you mean give the IFrame a URL that points at the 2nd WebDev GET endpoint, yes.

---

<div class="post-metadata">

**Author:** ![milbar](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@milbar](https://forum.inductiveautomation.com/u/milbar)\
**Post date:** [February 28, 2024, 3:57pm UTC](https://forum.inductiveautomation.com/t/can-i-use-dopost-to-send-data-through-the-webdev-module-pocess-it-and-see-the-page-in-an-iframe-in-perspective/86459/11 "2024-02-28T15:57:43Z")

</div>

I think the database might be the way to go. This way I can store a single image of the chart that I can use for a report, as well. What do you think?

Would I just put the entire html code in the database?

If yes, would I run an insert or update query in the doPost endpoint to do this?

Then, In the doGet do I run a query to retrive and return the html?

Sorry for all the questions. the WebDev module is a bit to wrap my head around.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 28, 2024, 4:03pm UTC](https://forum.inductiveautomation.com/t/can-i-use-dopost-to-send-data-through-the-webdev-module-pocess-it-and-see-the-page-in-an-iframe-in-perspective/86459/12 "2024-02-28T16:03:03Z")

</div>

> [@milbar](#):
>
> entire html code in the database?

I would.

> [@milbar](#):
>
> insert or update

I would insert, and use `getKey=True` to retrieve the new ID in the DB, and message that to the Perspective session for it to build the IFrame URL.

> [@milbar](#):
>
> doGet do I run a query to retrive and return the html?

Yes.
