title: Insert data in wordpress by clicking on the button
body: <p>I can not insert this in wordpress. Does not insert anything.If you can help me thank you</p>
  
  <p>How can I do this in ajax?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>  &lt;input type="submit" name="" value="" id="boton1" onclick = "rating();"&gt;
  
                &lt;?php
                function rating(){
                    global $wpdb;
                 $wpdb-&gt;insert( 'rating', 
                   array( 
                      'rating_postid'=&gt;'120', 
                      'rating_posttitle'=&gt;'title',
                      'rating_rating'=&gt;'5'                  
                    )
                  ); 
                }  
                add_action('wp', 'rating');
    
                ?&gt;</code></pre>
  </div>
  </div>
  </p>