I’m developing a WP plugin and I need that each time the user press a button in the metaboxes field, the form appears bellow the first one, so the user can add as many as they need WITHOUT RELOAD THE PAGE. I’ve been trying a lot for at least 3-4 days with no success 🙁
My metabox is:
My code in metaboxes.php is the following:
I Created a metabox_ajax.php file where the form is inside a function called in “metabox.php”, I did this thinking that “when button is pressed, send a counter in order to add the counter in the next forms to be able to add all of them into db”
metabox_ajax.php
I also created the script in order to use ajax in scripts.php file inside my plugin:
scripts.php
as you can see at the end of this file i’m creating the ajax_url to use /wp-admin/admin-ajax.php
And finally this is my js file:
And this is what I see in wp (also, when I press the button, the page reload):
- Hiện tại chúng tôi có hơn 25 nghìn bài văn mẫu các thể loại.
- Kho tài liệu, đề thi học sinh giỏi các lớp vô cùng phong phú.
- Mỗi ngày cập nhật hơn 100 đề thi chất lượng từ các website bán tài liệu lớn.
Tải đề thi VIP với giá siêu rẻ tại Vip.Dethihsg247.Com