Custom Metabox with Ajax in Edit Post – Stuck

If you end goal is to add text boxes dynamically, but still require the user to save/update the post, you don’t need to use AJAX at all.

Just name the text fields appropriately so an array of values is POSTed, then handle it in your save action.

It may be helpful to save this array in a single post meta key, so you can just loop through it to output the meta box.

Give an ID to the enclosing <div>, something like ‘slideshow_metabox’

Set your initial text boxes as so:

<input type="text" style="position: relative; right: 0; width: 85%;" name="slideshow[]" value="<?php echo $value; ?>" />

And change your ‘add button’ onclick to be:

function() {
    jQuery('#slideshow_metabox').append('<input type="text" style="position: relative; right: 0; width: 85%;" name="slideshow[]" value="" />');
}

Hope this helps.