thanks Klaus, looks like I'll have to bite the bullet with this json thing

thanks alot!

On 9/18/06, Klaus Hartl < [EMAIL PROTECTED]> wrote:
You can try that and it makes more sense to me than extracting the data
from your html.

I recommend using JSON for that. The response looks something like:

{'title':'home_reviews', 'content':'<h2>New content</h2><p>content</p>',
'image:'', 'music':3}

And your call (you can even have some error handling here):

$.ajax({
     url: "./content/?" + htmlDoc,
     dataType: 'json',
     success: function(json) {
         // process json...
     },
     error: function() {
     }
})


-- Klaus


Sam Sherlock schrieb:
> would it help if I returned an object rather than a seris of HTML nodes?
>
> eg the following
> [title:'home_reviews', content:'<h2>New content</h2><p>content</p>',
> image:'', music:3]
>
> if so what would be the syntax I would use to access the various parts
> of the object?
>
>
>                 $.get("./content/?"+htmlDoc,function(obj)    {
>                     console.info('title: ' + obj.title);
>                 }
>
> still looking for a workable solution.
>
> thanks - S
>
> On 9/18/06, *Christof Donat* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:
>
>     Hi,
>
>      > > resolve div#music to #music... ?
>      >
>      > Err, no, that wouldn't be a good idea, in case someone actually
>     *wants*
>      > to distinguish between elements here... (although I cannot think of a
>      > concrete example right now).
>
>     Well, it would be possible to use getElementByID('music') and then
>     see if the
>     returned node is a div. It would deffinately be faster than using
>     getElementsByTagName('div') and search that list for the one with the
>     ID 'music'. I don't know what John did use.
>
>     Christof
>
>     _______________________________________________
>     jQuery mailing list
>     [email protected] <mailto:[email protected]>
>     http://jquery.com/discuss/
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to