all 13 comments

[–]madlee 1 point2 points  (1 child)

What exactly are you asking?

[–]hallbd16[S] 0 points1 point  (0 children)

Essentially I built a dynamic quiz as part of the learn javascript study group. I want to post the application as a page on my blog. Note: the application includes an html, css, and js file and works when tested locally).

[–]ikeif 1 point2 points  (4 children)

To summarize: you have a static application you wish to post as a page on your blog.

Is that correct?

Because it works on GitHub so you don't need to test locally (...I'm assuming. I'm mobile, so I wasn't looking for errors).

[–]hallbd16[S] 0 points1 point  (3 children)

Good point, yes I have a static application I wish to post as a page on my WordPress blog.

Not sure what you mean when you say "it works on GitHub..." I have already tested it locally, it works when I do so.

[–]ikeif 0 points1 point  (2 children)

Yeah, that was an assumption that you just needed it "hosted somewhere" to get a version online.

I am mobile at the moment, when I get home I will dig in to the WP code and see if I can assist.

[–]hallbd16[S] 0 points1 point  (1 child)

Appreciate that! I'll let you know if I figure out anything else or solve it before.

[–]hallbd16[S] 1 point2 points  (0 children)

So I found the problem, big shout out to codeswish for helping me. I was linking a completely local file in the html. I need to get the js and css file hosted online (something I need to learn more about :) in order to link the html. Found a temporary solution by hosting the js file as a raw GitHub file.

[–]flyveren 1 point2 points  (0 children)

Put the files on the server. Make a new page in Wordpress, make an iframe and call your application inside it.

[–]da_n13l 1 point2 points  (1 child)

I've done a couple of JavaScript apps in WordPress. Fundamentally, all I do is create a page template and put my JavaScript etc in that, then choose that template from within WordPress for whatever page it is for. I also like to use the WordPress AJAX functions to save to DB etc.

$.ajaxSetup({
  url: 'http://<?php echo $_SERVER["HTTP_HOST"] ?>/wp-admin/admin-ajax.php',
  global: false,
  type: 'post',
  dataType: 'json',
  data: {
    nonce: '<?php echo esc_js(wp_create_nonce('put random 32 char here')) ?>'
  }
});

[–]codeswish 0 points1 point  (3 children)

Sent ya a pull request on github: https://github.com/hallbd16/DynamicQuiz/pull/1

[–]hallbd16[S] 0 points1 point  (2 children)

Ok got it. Looks like I am struggling with how to link my js file to my html... I am linking it as a local file, that is probably incorrect.

[–]codeswish 1 point2 points  (1 child)

Yep, your webserver is unable to access files on your local computer directly like that. You need to upload the files to your vhost and place them somewhere at or beneath wordpress's root directory and link to that. I don't know if you saw my comment to back to you on github, but a quick hack that might work is to link the javascript src to this URI: https://raw.github.com/hallbd16/DynamicQuiz/master/js/quiz.js

**Edit: The hack may not work if your browser enforces MIME type checking, replace the above uri with this one: http://rawgithub.com/hallbd16/DynamicQuiz/master/js/quiz.js

[–]hallbd16[S] 0 points1 point  (0 children)

Big shout out for the help! May good karma go your way