Jquery ajax call from javascript to PHP

前端 未结 4 2060
失恋的感觉
失恋的感觉 2020-12-18 14:02

There seems to be a problem with the code I have for calling php from javascript with jquery ajax. The ajax call seems to be successful but I don\'t get the correct informa

4条回答
  •  执笔经年
    2020-12-18 14:45

    You actually need to execute the query you create:

      $sql = "DELETE FROM dtree_table WHERE nid='$node'";
    
      $result = mysql_query($sql);
    
      return $sql;
    

    Then result will contain a Boolean of success status.

    Also when you pass it back to the javascript call you may need to set the appropriate page header of plaintext or json (if you decide to use json)

    I highly recommend using a tool like Firebug to watch each ajax request. Then you can see the posted data, response data, and headers to help you diagnose your issue further. Currently only Firefox (AFAIK) fully supports the firebug extension, but firebug lite is also available for other browsers.

提交回复
热议问题