douzheng0702 2011-10-31 12:48
浏览 38

编码在提交时生成图像弹出窗体的表单

I'm looking for some general advice on the code design of a form which has to generate an image when submitted. I'm new to this, and the data communication from the form to the image generator has me stumped. Any advice appreciated (I've got lots of C experience, a bit of JavaScript, no php).

Problem: a user has to fill in a form (in Joomla). The user sets a number of parameters, and hits submit. When I see the submission, I have to call a C program, passing it the form parameters. The C program then outputs JavaScript (which codes for an SVG image). This image must then appear (preferably in a modal) at the client's browser.

I haven't been able to find an existing Joomla extension which does anything like this, or which I can modify to do this.

I can write php to call the C code, but how do I get the form data to the php, and arrange for display inside the popup? I've got a general idea of how I can use jQuery to respond to a form submission and to generate a popup using data from a form (along the lines of http://www.sohtanaka.com/web-design/inline-modal-window-w-css-and-jquery/). However, I can't see that this is relevant. The main problem is that I have to generate the SVG JavaScript on the server, and I can't influence this from the client jQuery code (I think). The client code can't, I think, do much more than style the popup.

Any pointers appreciated.

  • 写回答

1条回答 默认 最新

  • dongtuo8170 2011-11-01 07:05
    关注

    Couldn't you do something like this...

    HTML

    <form id="svgGetter">
    //form content
    </form>
    
    <div id="svgSetter"></div>
    

    jQuery

      $('form#svgGetter').submit(function() {  
        alert("Posting data...");  
    
        $.post("yoursvgcreater.php", $(this).serialize(), function(data) {  
          if (data)  
          {  
            alert("It worked.");  
            $('svgSetter').wrapInner('<svg />').append(data);
          }   
        });  
        return false;  
      });  
    
    评论

报告相同问题?

悬赏问题

  • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?
  • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)
  • ¥20 怎么在stm32门禁成品上增加查询记录功能
  • ¥15 Source insight编写代码后使用CCS5.2版本import之后,代码跳到注释行里面
  • ¥50 NT4.0系统 STOP:0X0000007B
  • ¥15 想问一下stata17中这段代码哪里有问题呀
  • ¥15 flink cdc无法实时同步mysql数据
  • ¥100 有人会搭建GPT-J-6B框架吗?有偿