Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7593995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:18:35+00:00 2026-05-30T21:18:35+00:00

Okay, so I have an AJAX function that gets a JSON encoded string from

  • 0

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;
        }
    });
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:18:36+00:00Added an answer on May 30, 2026 at 9:18 pm
    var tmp = localZoneTileMap.split("*");
    
    var someArray = [];
    for (i = 0; i < tmp.length; i++) {
        someArray.push(tmp[i].split(","));
    }
    

    If using JavaScript 1.6 or newer, you can use the map() method

    var someArray = localZoneTileMap.split("*").map(function(tileMap) {
        return tileMap.split(",");
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay I have a large CRUD app that uses tabs with Forms embedded in
Okay so I have the following Code which appends a string to another in
Okay background i am a js and ajax noob. I work mainly in php
hello i have some problems with my php ajax script i'm using PHP/mysql i
I have some problems with ajax responses. Everything is working okay, however I got
I have a function that dynamically adds events to the calendar. function AddEventSourceDetailed(act_id) {
I have a function which loads up relevant js functions on click using ajax's
Okay, what have I done wrong here? I'm trying to .POST data from a
I have a form that submits through Ajax, which works perfectly at the moment.
Okay, so I have this page, which has one Ajax:AsyncFileUploader also some other ajax

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.