Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- $(document).ready(function()
- {
- $("#color-submit").click(function()
- {
- $.ajax(
- {
- async:false,
- type:"POST",
- url:"<?php echo plugins_url('/query/colorsubmit.php',__FILE__);?>",
- data:$("#color-form").serialize(),
- dataType:'json',
- success:function(response)
- {
- alert(response.msg);//var object = JSON.parse(response);
- $(".jumbotron").css({"background-color":"#FF8745"});
- //alert(response['msg']);
- var obj=response.msg;
- console.log(obj);
- }
- }
- );
- });
- });
- </script>
- <?php
- $return = array();
- //include_once("../../../../wp-config.php");
- global $wpdb;
- $color_value=$_POST['color-field'];
- if($wpdb->query("UPDATE color_form SET color='$color_value'"))
- {
- $msg="Form Updated";
- }else
- {
- $msg="not form Updated";
- }
- //$fetch_color=$wpdb->get_results("select color from color_form",ARRAY_A);
- //$return=$fetch_color;
- $return['msg']="sdgsdgsd";
- echo json_encode($return);
- // wp_send_json_success($return);
- //wp_send_json($return);
- //$wpdb->flush();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement