Skip to content

Completed Ajax Without jQuery Recipe #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 16, 2012

Conversation

OakRaven
Copy link
Contributor

Created new Ajax chapter and added new Ajax without jQuery recipe. Also updated authors list as well as wanted-recipes to remove completed recipes. Corrected minor issue with math/random-integer recipe and ordered list issue with index.html file(s).

OakRaven added a commit that referenced this pull request May 16, 2012
Completed Ajax Without jQuery Recipe
@OakRaven OakRaven merged commit 4f45abc into coffeescript-cookbook:master May 16, 2012

Next, create the CoffeeScript file to hold the page logic. The code in this file creates a function to be called when the Load Data button is clicked.

{% highlight coffeescript linenos %}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://coffeescript-cookbook.github.io/chapters/ajax/ajax_request_without_jquery

# XMLHttpRequest.coffeeloadDataFromServer=->req=newXMLHttpRequest()req.addEventListener'readystatechange',->ifreq.readyStateis4# ReadyState CompletesuccessResultCodes=[200,304]ifreq.statusinsuccessResultCodesdata=eval'('+req.responseText+')'console.log'data message: ',data.messageelseconsole.log'Error loading data...'req.open'GET','data.json',falsereq.send()loadDataButton=document.getElementById'loadDataButton'loadDataButton.addEventListener'click',loadDataFromServer,false

U should remove linenos , as I understand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants