GithubHelp home page GithubHelp logo

Ajax HTTP GET Request Error about pebblejs HOT 4 CLOSED

pebble avatar pebble commented on August 20, 2024
Ajax HTTP GET Request Error

from pebblejs.

Comments (4)

Meiguro avatar Meiguro commented on August 20, 2024

What are the parameters of your URL? ajax doesn't url encode what's passed in the url field because it's to be interpreted as the literal URL. The traceback (thanks for pasting it) indicates it's experiencing an error as soon as it sends the XHTMLRequest, meaning the XHTMLRequest implementation of the JS host environment is not happy with the parameters used to form the request. It looks like in this case it's something in the URL, so it would be great to see what it is. If it's a secret token, you can give a similar but fake one, or invalidate it.

from pebblejs.

randomite avatar randomite commented on August 20, 2024

Hey Meiguro,

A sample request would be:

www.ravinsardal.me/pebble/sparkcorecontrol/h.php?token=55d9e679f6015ef2d2852f9c394xbf75340c52f&id=53ge6d066667824850192167&function=turnOn

from pebblejs.

Meiguro avatar Meiguro commented on August 20, 2024

Ah, I should have noticed sooner, the issue is that no protocol is specified. The url needs to be prefixed with http:// or https://. The rest of the url has no issues. Let me know if that fixes the issue for you.

I decided not to automatically prefix 'http://' for the user since sometimes too much magic could cause issues for advanced use cases, but I do agree that the error is very cryptic. It turns out however that it's an issue with the exception details. Strangely the exception that bubbles up has no name or message, yet it converts to the string 'Invalid URL'. I'll patch pebble.js to be able to handle this kind of exception.

from pebblejs.

randomite avatar randomite commented on August 20, 2024

Ah ha, I can't believe I missed this one, thanks again!!

from pebblejs.

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.