create ajax request and save dateArray as js variable