weixin_33725272 2013-06-24 12:11 采纳率: 0%
浏览 20

用ajax发布不起作用

So i have a form like so:

 <form>
     <input type="submit" value="X" id="deleteButton" onclick="ConfirmChoice(<?php echo $id; ?>)" />
 </form>

and a function like this:

<script type='text/javascript'>
function ConfirmChoice(theid) 
{ 
    var dataString = 'id=' + theid;
    answer = confirm("Are you sure you want to delete this song?");
    if (answer !=0) {
        $.ajax
        ({
            type: "POST",
            url: "deleteSong.php",
            data: dataString,
        });
    } 
}

</script>

So basically I want it to delete whatever they click on from my database which deleteSong will take care of. It gives the id of the song and as far as I know should confirm deletion then delete it right? Any help would be appreciated. Thanks

  • 写回答

3条回答 默认 最新

  • weixin_33717117 2013-06-24 12:14
    关注

    change it from

    input type="submit" to

    input type="button"
    
    评论

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)