拆分不适用于数组

I am using following code but the split is not being performed and the code below the split command is not executing . Some how it looks that split command is halting or either not working . The string temp which is returned is "1,2,3,4,5-9,6,5" . Note : I have already initialzed a blank variable temp so no need to initialize it again in this function i guess.

function showUser(str) {
 
    if (window.XMLHttpRequest) {
        xmlhttp = new XMLHttpRequest();
    } else {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    
    xmlhttp.onreadystatechange = function() {
        temp=[xmlhttp.responseText];
        
        var temp2 = temp.split("-");
        myData=temp2[0];
        window.alert(myData);
        myLabels=temp2[1];
        net();
        
    }
        
    xmlhttp.open("GET","new.php?q="+str,true);
    xmlhttp.send();
        
}

</div>

There is no problem with the string split in javascript. Take a look at this:

var temp = '1,2,3,4,5-9,6,5';
var temp2 = temp.split("-");
myData=temp2[0];
window.alert(myData);
myData2=temp2[1];
window.alert(myData2);

Example

Try debugging if temp variable's value is correct.