ajax

how to like/unlike with button using toggleclass

孤街浪徒 提交于 2021-02-10 17:36:19
问题 this is my like button... HTML code <div class="btn"> <div class="boxcoracao"> <span class="coracao" id = "<?php echo $postid?>" name = "like">br>   Love</span> </div> </div>    Jquery inside HTML <script> $(".btn ").click(function(){ $('.boxcoracao .coracao', this).toggleClass("ativo"); }); </script> it works when i click and unclick the button the button changes but what my problem is how can i use this function to save data to my database. sample when 1st click the button it will like..

multiple ajax call to single function javascript

梦想与她 提交于 2021-02-10 16:07:28
问题 I have 3 ajax call. Data from each ajax call is passed to john_doe(); Call 1 $.ajax({ url: url1, dataType: "JSON", type: "GET", }).success(function(data1){ john_doe(data1); }); Call 2 $.ajax({ url: url2, dataType: "JSON", type: "GET", }).success(function(data2){ john_doe(data2); }); Call 3 $.ajax({ url: url3, dataType: "JSON", type: "GET", }).success(function(data3){ john_doe(data3); }); Main function function john_doe(param){ console.log(param); //Print data from all three ajax call. } How

multiple ajax call to single function javascript

有些话、适合烂在心里 提交于 2021-02-10 16:01:47
问题 I have 3 ajax call. Data from each ajax call is passed to john_doe(); Call 1 $.ajax({ url: url1, dataType: "JSON", type: "GET", }).success(function(data1){ john_doe(data1); }); Call 2 $.ajax({ url: url2, dataType: "JSON", type: "GET", }).success(function(data2){ john_doe(data2); }); Call 3 $.ajax({ url: url3, dataType: "JSON", type: "GET", }).success(function(data3){ john_doe(data3); }); Main function function john_doe(param){ console.log(param); //Print data from all three ajax call. } How

multiple ajax call to single function javascript

别来无恙 提交于 2021-02-10 16:01:17
问题 I have 3 ajax call. Data from each ajax call is passed to john_doe(); Call 1 $.ajax({ url: url1, dataType: "JSON", type: "GET", }).success(function(data1){ john_doe(data1); }); Call 2 $.ajax({ url: url2, dataType: "JSON", type: "GET", }).success(function(data2){ john_doe(data2); }); Call 3 $.ajax({ url: url3, dataType: "JSON", type: "GET", }).success(function(data3){ john_doe(data3); }); Main function function john_doe(param){ console.log(param); //Print data from all three ajax call. } How

The content loaded by ajax does not take the styles of the page

岁酱吖の 提交于 2021-02-10 14:38:59
问题 With ajax I am bringing content to upload my website with information. What the page does is load everything normally first, then execute the corresponding ajax, but when loading the ajax and placing the appropriate information, this information does not apply the styles of the web page. Here is an example of how my code would be: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <!-- Styles that you do not recognize --> <link rel="stylesheet" href="css

jquery ajax get database results using php json encode

痞子三分冷 提交于 2021-02-10 13:33:08
问题 I have this php code that is call using jQuery ajax that queries a database and gets results and then json encode the results //$rows is another query foreach($rows as $row) { $sql = 'SELECT field1, field2 FROM table WHERE field1= :field'; $stmt = $db->prepare($sql); $stmt->bindValue(':field', trim($row['field_1'])); $stmt->execute(); $array = $stmt->fetchAll(PDO::FETCH_ASSOC); echo json_encode($array); } The outputting json looks like this [{"field1":"J1","field2":"0088","field3":"2928868"}]

JSON Response Long is Rounded or Corrupted [duplicate]

故事扮演 提交于 2021-02-10 12:00:45
问题 This question already has answers here : Large numbers erroneously rounded in JavaScript (6 answers) Closed 5 years ago . I am sending JSON from the server to client side. The JSON contains a long . It appears that the number is being rounded or something because: The server side number sent is: 1036647050030089506 The client side number received is: 1036647050030089500 Why is this happening and how can I fix this? Server side code: Post["team", true] = async (parameters, ct) => { var team =

JSON Response Long is Rounded or Corrupted [duplicate]

北城余情 提交于 2021-02-10 12:00:36
问题 This question already has answers here : Large numbers erroneously rounded in JavaScript (6 answers) Closed 5 years ago . I am sending JSON from the server to client side. The JSON contains a long . It appears that the number is being rounded or something because: The server side number sent is: 1036647050030089506 The client side number received is: 1036647050030089500 Why is this happening and how can I fix this? Server side code: Post["team", true] = async (parameters, ct) => { var team =

JSON Response Long is Rounded or Corrupted [duplicate]

狂风中的少年 提交于 2021-02-10 11:59:50
问题 This question already has answers here : Large numbers erroneously rounded in JavaScript (6 answers) Closed 5 years ago . I am sending JSON from the server to client side. The JSON contains a long . It appears that the number is being rounded or something because: The server side number sent is: 1036647050030089506 The client side number received is: 1036647050030089500 Why is this happening and how can I fix this? Server side code: Post["team", true] = async (parameters, ct) => { var team =

JSON Response Long is Rounded or Corrupted [duplicate]

亡梦爱人 提交于 2021-02-10 11:59:45
问题 This question already has answers here : Large numbers erroneously rounded in JavaScript (6 answers) Closed 5 years ago . I am sending JSON from the server to client side. The JSON contains a long . It appears that the number is being rounded or something because: The server side number sent is: 1036647050030089506 The client side number received is: 1036647050030089500 Why is this happening and how can I fix this? Server side code: Post["team", true] = async (parameters, ct) => { var team =