调用函数时获取typeError

I am getting error - TypeError: updateAPI is not a functionn I am not sure why this is happening

the code for the function is as below

var APIS = '<?=preg_replace("/'/", "\'", json_encode($apis))?>';
var APISP = $.parseJSON(APIS);

var changedTo = 'left';
var updateAPI = function(id)
{
    /* Function Statements */
};

The code through which I am calling this function is

window.setInterval(function() {
var ele = document.getElementById('itemSelector');
updateAPI((ele.options[ele.selectedIndex].id).replace(/[_\D]+/, ''));
}, 100);

Can anybody help? Thanks in advance.

Your use of escape character is wrong. It is evident even after seeing the formatting of your question done by StackOverflow. You have used forward slash (/) instead of backward slash (\). Hence, var updateAPI is included in that string and updateAPI is undefined.
Try this:

var APIS = '<?=preg_replace("\'/", "\'", json_encode($apis))?>';

OR maybe depending on what regular expression you want, you might want this:

var APIS = '<?=preg_replace("/\'/", "\'", json_encode($apis))?>';