jQuery的没有AJAX发送数据到PHP [英] jquery send data to php without ajax

查看:73
本文介绍了jQuery的没有AJAX发送数据到PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在没有ajaxy天赋的情况下,我该怎么办?我需要调试麻烦的php脚本.点击图片后,表单就不会执行以下操作.

How can I do this without the ajaxy goodness? I need to debug a troublesome php script. There isn't a form just an image that when clicked performs the following.

$.post("php/navTabs.php", { action: "deleteTab", theHTM: thehtm }, function(jdata) {
    alert("The tab was " + jdata.is_deleted);
}, "json");

再次感谢, 托德

推荐答案

简短的答案:您不能使用Javascript.

Short answer: you can't with Javascript.

长答案:

如果要避免使用AJAX,则有两个选择:

If you want to avoid using AJAX, you have two options:

1)使图像成为表单的一部分,并在单击按钮后提交隐藏的输入.

1) Make the image part of a form and submit hidden inputs upon clicking the button.

   <form method="form.php" action="post">
        <input type="hidden" name="action" value="delete"/>
        ...rest of form...
   </form>

2)使图像成为链接,并在URL上附加输入.喜欢:

2) Make the image a link with the inputs tacked onto the URL. Like:

   form.php?action=delete

但是不确定为什么要避免使用AJAX.

Not sure why you'd want to avoid using AJAX, though.

这篇关于jQuery的没有AJAX发送数据到PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆