💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# jquery.form 表单ajax提交<https://cdn.bootcss.com/jquery.form/4.2.2/jquery.form.min.js> 英文文档<https://github.com/jquery-form/form> ### 使用方法 ``` <pre class="calibre16">``` $<span class="token2">(</span><span class="token4">"#btx"</span><span class="token2">)</span><span class="token2">.</span><span class="token1">click</span><span class="token2">(</span><span class="token5">function</span><span class="token2">(</span><span class="token2">)</span><span class="token2">{</span> $<span class="token2">(</span><span class="token4">'#form1'</span><span class="token2">)</span><span class="token2">.</span><span class="token1">ajaxSubmit</span><span class="token2">(</span><span class="token2">{</span> type<span class="token2">:</span> <span class="token4">'post'</span><span class="token2">,</span> <span class="token6">// 提交方式 get/post</span> url<span class="token2">:</span> <span class="token4">''</span><span class="token2">,</span> <span class="token6">// 需要提交的 url</span> data<span class="token2">:</span> $<span class="token2">(</span><span class="token4">"#form1"</span><span class="token2">)</span><span class="token2">.</span><span class="token1">formSerialize</span><span class="token2">(</span><span class="token2">)</span><span class="token2">,</span> beforeSubmit<span class="token2">:</span><span class="token5">function</span><span class="token2">(</span><span class="token2">)</span><span class="token2">{</span> <span class="token6">//数据验证</span> <span class="token2">}</span> <span class="token2">,</span> success<span class="token2">:</span> <span class="token5">function</span><span class="token2">(</span>rs<span class="token2">)</span> <span class="token2">{</span> <span class="token6">//处理返回值</span> <span class="token2">}</span><span class="token2">,</span> resetForm<span class="token2">:</span> <span class="token3">true</span><span class="token2">,</span><span class="token6">//重置表单</span> dataType<span class="token2">:</span> <span class="token4">'json'</span><span class="token6">//数据格式</span> <span class="token2">}</span><span class="token2">)</span><span class="token2">;</span> <span class="token5">return</span> <span class="token3">false</span><span class="token2">;</span><span class="token6">//组织跳转</span> <span class="token2">}</span><span class="token2">)</span><span class="token2">;</span> $<span class="token2">(</span><span class="token4">'#myFormId'</span><span class="token2">)</span><span class="token2">.</span><span class="token1">resetForm</span><span class="token2">(</span><span class="token2">)</span><span class="token2">;</span> ``` ```