Inserting the contents of another page, using Lift
Sorry if this is a dumb question, I'm new to Lift.
Suppose I already have a URL on returning dynamically generated content, at e.g. /data/???
. I'd now like to include this include inside a div
on another page, based on user input. I would have thought I could use do this "by hand" using jQuery, e.g.
<input type="text" onchange="$('#dynamic').load('/data/' + this.value)"/>
<div id="dynamic"/>
开发者_运维技巧
and indeed this works outside of Lift. When I do this on a page served by Lift, however, the content doesn't load, and looking in the Javascript console I see an INVALID_STATE_ERR
, DOM exception 11, being thrown from deep inside jQuery.
Two questions:
1) Why is this happening? Can I fix it and continue using jQuery's load function 'by hand' on a Lift generated page?
2) What is 'the Lift way' to dynamically update a
div
, based on content generated outside of Lift?
jQuery seems to be unhappy dealing with XHTML here. Make sure that the "outer" page is not delivered with an XHTML mimetype, e.g. LiftRules.useXhtmlMimeType = false
and jQuery works again.
精彩评论