weixin_33749242 2016-11-11 12:53 采纳率: 0%
浏览 31

获取表单网址而不提交

I am a newbie when it comes to JQuery or Javascript -- so apologies if this is an easy one...

Basically, I have a GET form -- which I need to intercept -- meaning I need to call javascript instead of actually submitting the form, when the submit button is pressed. I would like to have the complete URL as a output... something like...

http://server/cgi-bin/status.py?val=1223&val2=434334&val3=4343 

form -

Basically, I need the form to process the URL as if it would submit, but not submit. Main requirement is to send this link vial mail to the customers so they can track the job progress using this link

Thanks, Prince

  • 写回答

2条回答 默认 最新

  • Memor.の 2016-11-11 12:59
    关注

    This can be done with something like this

     $('form').on('submit', function(event) {
        var url = '<insert-path-to-desired-script>?' + $(this).serialize();
    
        event.preventDefault();
    });
    

    The event.preventDefault() makes sure the form doesn't actually submit.

    url then contains a full url with all the form properties in it.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败