Skip to content

Making the Ajax Request

bapquad edited this page Feb 20, 2022 · 3 revisions

[Home] > Making the Ajax Request

This content we learn how to make an Ajax request in Element5JS API.

Create new an ajax request

You can make an ajax request to a URL.

let xhr = request5.Connect("/variables.txt", ()=>{
  let data = xhr.readVariables();
  $("#wrapper").html(`
    <p>Name: `+data.name+`<p>
    <p>Episode: `+data.episode+`</p>
  `);
});

And the variables.txt file contains the content like as following.

name=JamesBone&episode=1