0

I am more or less a newby and hobby coder. I am currently working on a project where I want the following to happen:

If a user clicks on a certain word on a website, I want Javascript (pref. Ajax) to fetch the word and e.g. spit it out in the console.

Does Ajax offer something simmilar or how would you build that in JS?

Tom Doe
  • 21
  • 5
  • 2
    When you say fetch you mean what? Search in some API, e.g., dictionary? Or just print the same word in the console? – Luan Nico Dec 22 '17 at 16:44
  • well, for now I would be happy with printing the word to the console. The overall goal would be to search in a translation API (google, bing etc.). – Tom Doe Dec 22 '17 at 16:45
  • if you just want to log the word you just clicked you don't need ajax – Federico klez Culloca Dec 22 '17 at 16:45
  • I searched the entire [Ajax](http://www.colgatecommercial.com/brands.aspx?brand=Ajax) product line but I found nothing that has any use case for words. – gforce301 Dec 22 '17 at 16:46
  • This has nothing to do with AJAX :/ – Mikey Dec 22 '17 at 16:46
  • Then you might want to take a look: https://stackoverflow.com/questions/7563169/detect-which-word-has-been-clicked-on-within-a-text – Luan Nico Dec 22 '17 at 16:48
  • thanks, I will take a look at this! – Tom Doe Dec 22 '17 at 16:49
  • For clarification, AJAX is when you make a request (to a different webserver or your own) that does't reload the screen. There a few APIs (fetch, xmlhttprequest) provided by JavaScript to do this, and it allows you to efficiently load dynamic information without reloading the whole page. – Luan Nico Dec 22 '17 at 16:51
  • Hi, thanks. Just to clarify, I actually meant JQuery. Due to work and studies, my last coding session has been a while - So, I really start lacking the damn basics. Thanks! – Tom Doe Dec 22 '17 at 16:58

0 Answers0