Okay, so I have an AJAX function that gets a JSON encoded string from a remote PHP file, the response looks like so..
{"zone_id":"1","zone_name":"Test Zone 1","zone_tilemap":"0,0,0,0*0,0,0,0*0,0,0,0*0,0,0,0","zone_objectmap":"0,0,0,0*0,0,0,0*0,0,0,0*0,0,0,0"}
I won't go too far into what this code is about, but the part I need right now is the tilemap, I need to somehow read those numbers into a mutlidimensional JavaScript array so it looks like so...
var someArray = new Array([0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]);
I know that in PHP there is an explode function that can break the string apart by the asterix and then by the commas and put the results into an array, but I'm not great at JavaScript and have no idea how to accomplish this, any ideas?
My AJAX function so far...
function getLocalZoneInformation(){
$.ajax({
type: 'POST',
url: "./inc/backend/game.functions.php?getLocalZoneInformation=" + localCharacterZoneID,
success: function(response){
var localZoneInformation = jQuery.parseJSON(response);
localZoneID = localZoneInformation.zone_id;
localZoneName = localZoneInformation.zone_name;
localZoneTileMap = localZoneInformation.zone_tilemap;
localZoneObjectMap = localZoneInformation.zone_objectmap;
}
});
}