Wkipedia Viewer

Hello i have had trouble with the ajax portion i was using and can acknowledge that it was from a lack of general knowledge on it, and was wondering if anyone had reccomendations on places to look for more information, and or courses,
thank you for any help or time you put into this even just reading it

It would be better if you could provide some of your code and shed some light on your errors.

Or if you are just looking for whereabouts to learn Ajax, below are some good resources.

Pure JS Ajax

Ajax

jQuery Ajax

Official jQuery Ajax

thank you for the links! and my project is pretty bad at the moment i don’t put any notes in so that doesn’t help, however when i got to trying to call specific pieces as opposed to calling the api url i hit a dead end(https://codepen.io/888_owl/pen/MVNMLg?editors=1011)

First of all you didn’t block the Default Behaviour of Submit thus, even though your ajax called, you didn’t see the results since you page reloads.

You can block any behaviour by catching event and preventDefault().

$("form").submit(function(e) {
   
   e.preventDefault();

//do something else
}

Your call has some issues right now. I will keep you updated as I found the source of error.

Thank you so much for showing me that i had completely forgotten that part, this is about the fourth time i have dissected and restarted this project

i added prevent default and now my error alert gave me the message

Error: [object Object]

i checked the console now that the call is going through to my get and i need to create credentials! thank you so much for everything

especially the links!
if getting the credentials in order doesnt fix it atleast my console will show errors for now

I have found the source of that problem as well.

Below is your full URL when you make the call

https://en.wikipedia.org/w/api.php?action=opensearch&search=hello&limit=10&namespace=0&format=jsonfm&callback=?

If you copy that link and open it on your browser tab. You will see this on top of the page before the responses.

This is the HTML representation of the JSON format. HTML is good for debugging, but is unsuitable for application use.

Specify the format parameter to change the output format. To see the non-HTML representation of the JSON format, set format=json.

See the complete documentation or the API help for more information.

As it is stated, whatever returning from your URL is not JSON. But in your Ajax call you specify that you will be expecting json format. Thus your call has an error.

Now try to go to this link, I have changed the format to JSON instead of JSONFM

https://en.wikipedia.org/w/api.php?action=opensearch&search=hello&limit=10&namespace=0&format=json&callback=?

You will see the json response if you open on a browser and if you try to console log the data returned from success call. You will see the responses now.

wow! it worked without credentials, thank you so much. i appreciate this alot i was losing my mind a little bit and just started studying other things to not go crazy but now i can push forward!