Site icon Hip-Hop Website Design and Development

change attachment customized area onChange occasion

The shape is in publish creating window. Ajax is posting values, however the values doenst renews. The place might be downside ?

Ajax

    <script>
perform dynamic_Select(area, assist, worth)
  {
console.log(area, assist,worth);
  jQuery.ajax({
    sort: "POST",
    url: ajaxurl,
    information:{
             area:    area,
             assist:      assist, 
             worth:    worth,
         },

    error: perform(){alert('Error!')},
    success: perform(){alert(worth)}     

  }); 
 }
 </script>

capabilities.php

add_action('wp_ajax_dynselect', 'update_dynamic_select');
add_filter("attachment_fields_to_save", " update_dynamic_select", null , 2);

 perform update_dynamic_select($area, $assist, $worth) { 

 update_post_meta($assist, $area, $worth);

}

HTML:

<choose assist="104" title="_image_matmenys" onchange="dynamic_Select(this.getAttribute('title'), this.getAttribute('assist') ,this.worth)">
   <choice worth="10x10">10x10</choice>
   <choice worth="20x20" chosen="chosen">20x20</choice>
   <choice worth="30x30">30x30</choice>
</choose>