php - jQuery .ajax function, exactly how to use it -


I am using WordPress and need to update the data of tables with jQuery AJAX, I have the following The code that successfully posts the data GE ('click', function () {var myname = jQuery ('# update- & lt ;; php echo $ row-> ID;; & gt;') Input [name = "name_two"] '). Val (); var mystep = jQuery ('# step & lt ;? php echo $ row-> ID;; & gt; option: selected'). Val (); jQuery.ajax ({Type: "POST", url: "/wp-content/plugins/gates/updateGateData.php", data: {name_two: myname, step_two: mystep}, success: function (data) {warning (' Data update ');},}};});

Now my problem is what to put in the UpdateGateOption.php file to post to the database update.

Thanks for the responses! So I have it now:

  $ name = $ _POST ['name_two']; $ Step = $ _POST ['step_two']; Global $ wpdb; $ Wpdb- & gt; Update ('gate_top'), array ('step' => gt; $ step, 'name' = & gt; $ name, 'image_path' = & gt; 'new img-path', 'options' = & gt; ; strtolower ($ name), 'value' = & gt; strtolower ($ name),));   

But the values ​​are not being updated, plus I can not see any error ..

updateGateOption.php:

  $ name = $ _POST ['name_two']; $ Step = $ _POST ['step_two'];   

Now run your query,

  if (mysql_query ("update tablename SET field 1 = $ name, field 2 = step ou 1 = 1 and YOUR_CONDITION ")) {Resonant" data update successfully "; } Else {echo "something went wrong"; }    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -