Edit in JSFiddle

$('[data-btn-toggle]').click(function()
{
    var btn = $(this).data('btn-toggle');

    $(this).text(function(i,v)
    {
        return v === btn.preview ? btn.edit : btn.preview;
    })
});

              
<button type="submit" class="btn btn-success" role="button" data-btn-toggle='{"preview": "Preview", "edit": "Edit"}'>Preview</button>