attempt to configure mimetype for ajax calls
This commit is contained in:
@ -121,6 +121,7 @@ module.exports = {
|
|||||||
bloggerCalls: function(req, res) {
|
bloggerCalls: function(req, res) {
|
||||||
client.get('https://www.googleapis.com/blogger/v3/blogs/2421288658305323950/posts?key=' + secrets.blogger.key, function (blog, res5) {
|
client.get('https://www.googleapis.com/blogger/v3/blogs/2421288658305323950/posts?key=' + secrets.blogger.key, function (blog, res5) {
|
||||||
var blog = blog.length > 100 ? JSON.parse(blog) : "";
|
var blog = blog.length > 100 ? JSON.parse(blog) : "";
|
||||||
|
res.type("application/javascript");
|
||||||
res.send({
|
res.send({
|
||||||
blog1Title: blog ? blog["items"][0]["title"] : "Can't connect to Blogger",
|
blog1Title: blog ? blog["items"][0]["title"] : "Can't connect to Blogger",
|
||||||
blog1Link: blog ? blog["items"][0]["url"] : "http://blog.freecodecamp.com",
|
blog1Link: blog ? blog["items"][0]["url"] : "http://blog.freecodecamp.com",
|
||||||
|
@ -3,7 +3,9 @@ script.
|
|||||||
(function() {
|
(function() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'http://freecodecamp.com/api/blogger',
|
url: 'http://freecodecamp.com/api/blogger',
|
||||||
type: 'GET'
|
type: 'GET',
|
||||||
|
crossDomain: true,
|
||||||
|
dataType: 'jsonp'
|
||||||
}).done(
|
}).done(
|
||||||
function(data) {
|
function(data) {
|
||||||
var props = Object.keys(data);
|
var props = Object.keys(data);
|
||||||
|
Reference in New Issue
Block a user