I suggest you read about functions, they are really useful.
You don't need AJAX if you are working with Local Storage.
If you need to save two arrays, you give them different item names. Then you check if "SettingsArray" exists and if "LevelsArray" exists. And you should have two "On item exists" events:
On item "SettingsArray" exists : SettingsArray load from LocalStorage.ItemValue
On item "LevelsArray" exists : LevelsArray load from LocalStorage.ItemValue
That's it.