Although there is currently no API in the JavaScript CSOM which lets you change the search center url directly, SharePoint stores the search settings in the Property Bag of the root SPWeb object in a sitecollection. You can set these property bag values and your search settings should get modified.
"SRCH_ENH_FTR_URL" – Search Center URL
"SRCH_SITE_DROPDOWN_MODE" – Search Scope Drop down option
"SRCH_TRAGET_RESULTS_PAGE” – Target Search Results page
Using JavaScript CSOM, you can set the values like this:
var ctx = new SP.ClientContext.get_current();
var web = ctx.get_site().get_rootWeb();
var props = web.get_allProperties();
props.set_item("SRCH_ENH_FTR_URL","/sites/search/pages");
web.update();
ctx.load(web);
ctx.executeQueryAsync(function () {
alert(props.get_item("SRCH_ENH_FTR_URL"));
},
function() {
alert("failed");
});