Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Feature request - handle text/json response #3212

Closed
@pehrlich

Description

@pehrlich

Currently, any unexpected response to loadpage will render a blank page saying "undefined". It would be really nice (and I think quite simple) to turn this in to an extension point instead. When responseHeaders are not html, trigger a custom handler with the data.

In concert with this, the code which shows the yellow error dialog could be move in to its own accessible method. Which could, in turn, be used by such a handler.

This could be used by json data returned from server errors or in a more lightweight form validation.

Thoughts?

Activity

toddparker

toddparker commented on Dec 12, 2011

@toddparker
Contributor

Would you mind linking this up to the feature request wiki page? Thanks!

johnbender

johnbender commented on Dec 12, 2011

@johnbender
Contributor

@pehrlich

Based on the description you've provided I'd be interested if the extension point we provide with pagebeforechange would serve (http://jquerymobile.com/demos/1.0/docs/pages/page-dynamic.html). In general this is a tool for the "I want to handle the request myself, including the page generation" scenario.

The only reason I ask is that I'd like to gauge the value of what you're proposing with regards to the more general solution we've provided.

pehrlich

pehrlich commented on Dec 13, 2011

@pehrlich
Author

Hmm. It looks like I can latch on to pageload event and there scan data.xhr.getResponseHeader('Content-Type') for json, calling any necessary handlers and stopping further propagation.

At this point data.page has already been populated (with undefined content) and added to the dom- a possibility for optimization.

Would still be great to be able to access that dialog independently.

Added to the wiki!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @johnbender@toddparker@pehrlich

        Issue actions

          Feature request - handle text/json response · Issue #3212 · jquery-archive/jquery-mobile