Send form data to CGI script
Re: Send form data to CGI script
Sorry for my scatterbrained mistake...my posting above is the working client HTML form , not the server script. Basically, I have to reproduce the functionality of the HTML code.
Re: Send form data to CGI script
redacted
Last edited by joedarock on Thu Aug 10, 2017 6:50 pm, edited 1 time in total.
Re: Send form data to CGI script
redacted
Last edited by joedarock on Thu Aug 10, 2017 6:50 pm, edited 1 time in total.
Re: Send form data to CGI script
I got it working...the last remaining problem was in my server script...dooooh!
How can I get status information or the server script's 'Print' output?
How can I get status information or the server script's 'Print' output?
Re: Send form data to CGI script
I didn't familiar with CGI script, you can download other 'backend'(php/c#/Node.js/java) demo code from here.
http://www.crossui.com/download.html
Basically, you need to response some script in your CGI script, like
html code
http://www.crossui.com/download.html
Basically, you need to response some script in your CGI script, like
html code
<script type='text' id='json'>{"parentDomain":"http:\/\/localhost","data":[{"p1":"client_set","p2":"server_set","time":"2017-08-11 00:30:35","rand":"12-30-358y2zwikhzt5yqqt0s"}]}</script> <script type='text/javascript'> parent.postMessage(document.getElementById('json').innerHTML,'http://localhost'.replace( /([^:]+:\/\/[^\/]+).*/, '$1')); </script>
Re: Send form data to CGI script
Unvortunately, the server is a small embedded device on a closed industrial network and installing another scripting engine isn't possible. My server script can "Print" either plain text or HTML to the client's browser. Can one of those be used to generate a response and how can the client javascript receive it?
Re: Send form data to CGI script
Essentially, the response script is text, which can be recognized as SCRIPT by the browser.
Re: Send form data to CGI script
Let me be more specific:
in my CrossUI app, I have a pane with the file combo and submit button. This sends the selected file. That much works. How can I get feedback from the server script to appear in the pane?
in my CrossUI app, I have a pane with the file combo and submit button. This sends the selected file. That much works. How can I get feedback from the server script to appear in the pane?
Re: Send form data to CGI script
1. When you uploaded finish, return html
<script type='text' id='json'>{"data":{"message":"ok"}}</script>
<script type='text/javascript'>
parent.postMessage(document.getElementById('json').innerHTML,'*');
</script>
2. If your xui code is:
xui.request(xxxxxx,{file:file},function(rsp){
xui.alert(rsp.data.message);
},function(errMsg){
xui.alert(errMsg)
}).start();
That will alert message "ok".
<script type='text' id='json'>{"data":{"message":"ok"}}</script>
<script type='text/javascript'>
parent.postMessage(document.getElementById('json').innerHTML,'*');
</script>
2. If your xui code is:
xui.request(xxxxxx,{file:file},function(rsp){
xui.alert(rsp.data.message);
},function(errMsg){
xui.alert(errMsg)
}).start();
That will alert message "ok".
Re: Send form data to CGI script
This worked...thanks a lot!