0

This is the what I'm doing at WordPress dashboard.

I'm working on WordPress plugin, and trying to save my input fields data against the particular product when the update button is clicked for the particular post/product.

I'm validating those input fields , sending an ajax request and updating the post_meta each time I click on the update button.

Little explanation of what I'm doing

I'm allowing the user to enter a link for youtube , vimeo or dailymotion video. Therefore I'm having drop-down and other input field for link where user would select the type-of-link (either vimeo, dailymotion, or youtube) and then s/he would enter the link of the video in the other input field.

Problem

I'm getting the type-of-link and the link successfully and so, I'm updating the post_meta successfully each time the type-of-link and the link is changed and the update buttons is clicked, BUT only when I use e.preventDefault() for the update button, when I remove e.preventDefault(), then the post_meta is not updating, although I have echo out the data I'm getting it correctly.

The code is working fine, when I use e.preventDefault() for the button, but when I remove e.preventDefault(), then the new data is not updating which I'm expecting the code to do so.

Note

I have asked the question here

Please help me, I'm stuck badly :(

Following are the input fields of which I'm getting the data.

enter image description here

  • Why are you using AJAX this way? You shouldn't need your own AJAX requests to update custom fields. – Jacob Peattie May 19 at 6:57
  • @JacobPeattie Because I want to validate the link if it is a valid link or not, and then save them in the DB, what other approach should I use? I'm new to plugin development. – mehmood khan May 19 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.