Skip to content
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 opened this issue Dec 3, 2011 · 3 comments
Closed

Feature request - handle text/json response #3212

pehrlich opened this issue Dec 3, 2011 · 3 comments

Comments

@pehrlich
Copy link

pehrlich commented Dec 3, 2011

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?

@toddparker
Copy link
Contributor

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

@johnbender
Copy link
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
Copy link
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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants