Q:

AJAX JQuery string result broken down by character

$.ajax({
    async: false,
    url: '@Url.Action("UpdateMS")' + "?MAC=" + $('#MAC').val() + "&Serial=" + $('#Serial').val() + "&I_ID=" + $('#I_ID').val(),
    dataType: "json",
    cache: false,
    success: function (data) {
        $("#Serial_Number").val("");
        $("#MAC_Address").val("");
        $("#Message").text(data);
        alert(data[0]);
        if (data[0] == 'D') {                        
            $("#PartOne").css("display", "inline");
            $("#PartTwo").css("display", "none");
            $("#MACSerial").val("");
            $("#MACSerial").focus();
        }
    }
});

data is a JSON string having the value Device Updated.
Here is the issue:
On Google Chrome and the like works like a charm.
data[0] has a value of "D"  (Ie. the first character in a string array).
Except on a stinky old mobile device it reports value undefined when i run my test alert!
data itself produces the proper string "Device Updated" correctly on all browsers.
Any ideas??  Thanks!

A:

Try using data.charAt(0). Your way of accessing a string is not supported by all browsers.
Check this JavaScript access string chars as array out, there's explanation as to why in the answers.

