plugins - update_post_meta is not working for me when I use e.preventDefault for update button

admin2025-03-20  5

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.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1742421497a212964.html

最新回复(0)