Skip to content
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

I need help with the ajax calls. #5

Open
findborg opened this issue Mar 9, 2015 · 2 comments
Open

I need help with the ajax calls. #5

findborg opened this issue Mar 9, 2015 · 2 comments

Comments

@findborg
Copy link

findborg commented Mar 9, 2015

I know that this should be very simple. But, I just can not figure out the ajax.
All I am trying to do is use a link to call say buttons.php into a div on the current page called winDow.
Please show me an example of this.
Note** Then I want to be able to call other pages like typo.php, components.php, etc.
I figured out how to do the router which is fine. But, I want to separate the sections into other pages and just bring them in via ajax.

@nhanfu
Copy link
Owner

nhanfu commented Mar 10, 2015

Hi Findborg,
You can try the ajax code below.

html.ajax('components.php')
    .done(function (pageContent) {
      html('#myDiv').text(pageContent); // append the content to your div
    }).fail(function (xhr) {
      console.log(xhr.statusText);          // log the error, statusText is usually used
    });

@findborg
Copy link
Author

Oh, I see. I could not figure out how to configure the done (function). I will give it a try.

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

No branches or pull requests

2 participants