3 Replies - 441 Views - Last Post: 12 December 2019 - 06:39 AM

#1 ajetrumpet   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 46
  • Joined: 09-November 19

assistance with XMLHttpRequest()

Posted 07 December 2019 - 11:54 AM

I am learning ajax stuff and jquery right now and I got a script from w3schools.com and modified to see if I could learn the concept properly, but I don't think I've quite got it. I was previously not using any ajax code and I started a previous thread here about that, but someone suggested that I need to use ajax in a case like this. this is my ajax code on a .php page:

https://drive.google...iew?usp=sharing

emptyReport() is called from a button, but when pressing the button, nothing happens. but this is not a form submission page, I am simply calling a page that runs a query in PHP. Is that where I'm incorrect here? Or am I perhaps using a function that deprecated? I heard that fetch() was introduced a long time ago...

sorry I can't post code here, even in the tags. this CloudFare security system they have setup here continually blocks me.

Is This A Good Question/Topic? 0
  • +

Replies To: assistance with XMLHttpRequest()

#2 ArtificialSoldier   User is online

  • D.I.C Lover
  • member icon

Reputation: 2498
  • View blog
  • Posts: 7,560
  • Joined: 15-January 14

Re: assistance with XMLHttpRequest()

Posted 09 December 2019 - 10:57 AM

That code has typographical quotes instead of regular straight quotes, and there's a missing closing quote on the URL. Check your browser's developer console for error messages.
Was This Post Helpful? 0
  • +
  • -

#3 JellyfishToo   User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 5
  • Joined: 09-December 19

Re: assistance with XMLHttpRequest()

Posted 09 December 2019 - 11:03 PM

You're right about using fetch, or JQuery at least. More details here.

Information from MDN on fetch

Here's a relevant snippet from that page:
const response = await fetch('http://example.com/movies.json');
const myJson = await response.json();
console.log(JSON.stringify(myJson));

Was This Post Helpful? 0
  • +
  • -

#4 ajetrumpet   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 46
  • Joined: 09-November 19

Re: assistance with XMLHttpRequest()

Posted 12 December 2019 - 06:39 AM

guys,

I have dropped this asynch issue and gone with PHP completely to get this task done. thanks for your help. I don't have enuf experience with AJAX stuff to do this yet, but I will learn it when I have time and post further questions here that are more meaningful than this one was when I get stuck again. thanks!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1