Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    So I have this XML file:
    Code:
    <Makes_Info>
    <Makes_Count>2</Makes_Count>
    ?
    <Makes_List>
    ?
    <Make_Info>
    <Make>Chevrolet</Make>
    </Make_Info>
    ?
    <Make_Info>
    <Make>Ford</Make>
    </Make_Info>
    </Makes_List>
    </Makes_Info>
    Not overly complicated, I know, but I don't need it to be right now.

    Anyway, I try to retrieve the XML file using the following code:
    Code:
     function processMakes(outputXML) {
        $("#js-tester").append($(outputXML).responseText);
        var makesCount = $(outputXML).find("Makes_Count").text();
        $(outputXML).find("Make_Info").each(function () {
            $("#js-tester").append($(this).find("Make").text() + "<br />");
        });
    }
    function alterMakeRow() {
        var makeRowValue = yearFieldId.val();
        if (makeRowValue != "") {
            createLoadingBox(makeFieldId);
            makeId.removeClass("invisible");
            ajaxurl = siteRoot + "ajax-xml/retrieve-makes/?year=" + makeRowValue;
            $.ajax({ type: "GET", URL: ajaxurl, dataType: "xml", complete: processMakes });
            $("#js-tester").load(ajaxurl);
        } else {
            clearOptions(makeFieldId);
            makeId.addClass("invisible");
        }
    }
    The bold line works. It shows the XML, complete and well formed and all that good stuff.

    The function processMakes doesn't work. When I try to append the responseText or see anything that has been loaded, I can't see a thing. I mean nothing. There's an object there, but I haven't the slightest idea what's in it, other than the tags that are supposed to be there aren't accessible e.g. the red line. I know full well Makes_Count is there. But I can't access it.

    So...before I go throwing stuff, what stupid thing am I missing?

    By the way, it doesn't make a difference if I pass the year as data, and complete vs. success didn't make a difference either.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  2.  

  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    Never mind. It (probably) wasn't me. I ended up using $.get instead of $.ajax, and everything worked.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:19 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com