GithubHelp home page GithubHelp logo

Specify the callback dataType about hello.js HOT 4 CLOSED

JNajera avatar JNajera commented on May 18, 2024
Specify the callback dataType

from hello.js.

Comments (4)

MrSwitch avatar MrSwitch commented on May 18, 2024

Erm... the library only works with json for some very good reasons. Why, do you see something else?

from hello.js.

JNajera avatar JNajera commented on May 18, 2024

Sorry I didn't explain it well. Im using Ruby on Rails with Devise, so for make it work manually without reload the page I need to post back on my callback_url as JSON.
This is an example using the FB JSDK (Sorry i only have it on coffeescript)

$(document).ready ->
  $("#facebook-connect").click (e) ->
    e.preventDefault()
    FB.login (response) ->
      if response.authResponse
        $.getJSON '/auth/facebook/callback', (data) ->
          # Do more stuff for login

When I use the hello.js library, the Hello.login() function do the callback, but I receive on my server the callback as dataType = "text/html"

Started GET "/auth/facebook/callback" for 127.0.0.1 at 2014-06-03 10:47:10 -0500
Processing by Devise::OmniauthCallbacksController#facebook as HTML

Instead im looking to mod the dataType of the ajax callback, only for the login method, like dataType = "application/json"

Started GET "/auth/facebook/callback" for 127.0.0.1 at 2014-06-03 10:49:14 -0500
Processing by Devise::OmniauthCallbacksController#facebook as JSON

I hope now its more clear. Thanks for your response.

from hello.js.

MrSwitch avatar MrSwitch commented on May 18, 2024

Sorry its still hard to understand. If you want to change the xhr request in hello.api() then take a look at https://github.com/MrSwitch/hello.js/blob/master/src/modules/windows.js#L145

Since the OAuth flow works by opening pages with test/html, i fail to grasp what you mean when you say "post back on my callback_url as JSON.".

from hello.js.

MrSwitch avatar MrSwitch commented on May 18, 2024

@JNajera please comment and i'll reopen this if its still an issue

from hello.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.