Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. <script>
  2.  
  3. $(document).ready(function()
  4. {
  5. $("#color-submit").click(function()
  6. {
  7. $.ajax(
  8. {
  9. async:false,
  10. type:"POST",
  11. url:"<?php echo plugins_url('/query/colorsubmit.php',__FILE__);?>",
  12. data:$("#color-form").serialize(),
  13. dataType:'json',
  14. success:function(response)
  15. {
  16. alert(response.msg);//var object = JSON.parse(response);
  17. $(".jumbotron").css({"background-color":"#FF8745"});
  18. //alert(response['msg']);
  19. var obj=response.msg;
  20. console.log(obj);
  21. }
  22. }
  23. );
  24. });
  25.  
  26. });
  27. </script>
  28.  
  29. <?php
  30. $return = array();
  31. //include_once("../../../../wp-config.php");
  32. global $wpdb;
  33. $color_value=$_POST['color-field'];
  34. if($wpdb->query("UPDATE color_form SET color='$color_value'"))
  35. {
  36. $msg="Form Updated";
  37. }else
  38. {
  39. $msg="not form Updated";
  40. }
  41.  
  42. //$fetch_color=$wpdb->get_results("select color from color_form",ARRAY_A);
  43.  
  44. //$return=$fetch_color;
  45.  
  46. $return['msg']="sdgsdgsd";
  47. echo json_encode($return);
  48. // wp_send_json_success($return);
  49. //wp_send_json($return);
  50. //$wpdb->flush();
  51. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement