Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How to fetch data with Ajax?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tony Ghy wrote:But for this case, I don't want to fetch all the data in some JSON at a go. If the user clicks on the 'more details' link, it should fetch the data...so Ajax seems better in this case. What say?



I have the same problem here. I am just beginner and do not have knowledge of AJAX or JSon. Will you please guide me how fetch the data using AJAX.
 
Marshal
Posts: 67424
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Writing up a whole tutorial on Ajax isn't appropriate for a forum post, but there are plenty of Ajax tutorials online.

However, it doesn't really make sense in 2018 to use the low-level Ajax API in your code. I'd advise adopting jQuery if you are not going to be using any other JS framework. It not only vastly simplifies Ajax, but also other knotty areas of JavaScript (DOM manipulation, event handling, etc).

If all you want is just Ajax assist, consider axios which only provides a higher-level Ajax API.
 
If you two don't stop this rough-housing somebody is going to end up crying. Sit down and read this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic