SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 45

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2011
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation how to click on a data in paging?

    hi
    i am doing a project and now i am try to work on paging, however i am stuck. I want to put in a list of links of website in the itemfilereadstore. So when show, i want to be able to click on any one of the link in the page, which will bring you to the selected website

    reference guide:
    http://dojotoolkit.org/reference-gui...agination.html

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,527
    Mentioned
    84 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by cutexxbaby View Post
    hi
    i am doing a project and now i am try to work on paging, however i am stuck. I want to put in a list of links of website in the itemfilereadstore.
    Your link didn't work, so here's one to the documentation for pagination

    Here's some documentation about itemfilereadstore
    It interprets and stores JSON data, that you might have retrieved from an Ajax request.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2011
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    Your link didn't work, so here's one to the documentation for pagination

    Here's some documentation about itemfilereadstore
    It interprets and stores JSON data, that you might have retrieved from an Ajax request.
    ya is the same link as i provide but the problem is that i want to put in link instead of text and i want it able for me to click on the link...what other code should i add in to put in as link and enable click on the link to bring to the website??
    P.s reply asps

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,527
    Mentioned
    84 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by cutexxbaby View Post
    ya is the same link as i provide but the problem is that i want to put in link instead of text and i want it able for me to click on the link...what other code should i add in to put in as link and enable click on the link to bring to the website??
    P.s reply asps
    Hang on, I don't know what asps is short for. Hmm ... Acronym Finder says that asps is short for Advanced Sleep Phase Syndrome which is where people go to bed early, and get up really early between 1am and 3am. I know that I was complaining about it being 2:30am in another post, so thank you for your concern, even though it's something of which I am not suffering from.

    I don't think that you meant Albino Squirrel Preservation Society, unless perhaps that is something that your web site is for that has not been stated yet.

    Never the less, dojo is one of those libraries that I haven't dealt with before. Perhaps you could instead try one of the options from the dojo support section of their site?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2011
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    Hang on, I don't know what asps is short for. Hmm ... Acronym Finder says that asps is short for Advanced Sleep Phase Syndrome which is where people go to bed early, and get up really early between 1am and 3am. I know that I was complaining about it being 2:30am in another post, so thank you for your concern, even though it's something of which I am not suffering from.

    I don't think that you meant Albino Squirrel Preservation Society, unless perhaps that is something that your web site is for that has not been stated yet.

    Never the less, dojo is one of those libraries that I haven't dealt with before. Perhaps you could instead try one of the options from the dojo support section of their site?
    nono...sry is my fault...i want to type asap...as soon as possible...really sorry that i type wrongly

    so what should i do....cause i also got the link that you have regarding paging, but the problem is i not able to click on the link...like what i say earlier, i want to put link and able to click on them, so you know what kind of code i should put????
    thanks!!!and sincerely sorry about typing wrongly

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,527
    Mentioned
    84 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by cutexxbaby View Post
    so what should i do....
    Perhaps you could try one of the options from the dojo free support section of their site?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  7. #7
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,527
    Mentioned
    84 Post(s)
    Tagged
    4 Thread(s)
    This is the part here:

    Code:
    var link = document.createTextNode(foodStore.getValue(item, "name"));
    list.appendChild(link);
    A text node is not a link. To create a link you would need to create an anchor element, set the href value, and append the text.

    You'll need to add a link to the name in your data store too, but after you do that you can do the following.

    Code javascript:
    link = document.createElement('a');
    link.href = foodStore.getValue(item, 'link');
    text = document.createTextNode(foodStore.getValue(item, "name"));
    link.appendChild(text);

    You could also move all of the variable declarations to the start of the function.
    The currentStart and currentCount are global variables required by dojo (from post #28) so those should remain at the start.

    Also, appending separately does impose a performance penalty, so we can instead append to a document fragment, which can then be appended right at the end of things.

    Here's what the gotItems() function looks like after the adjustments.

    Code javascript:
    function gotItems(items, request) {
        currentStart = request.start;
        currentCount = request.count;
     
        var list = dojo.byId("list"),
            i,
            item,
            itemsToAdd = document.createDocumentFragment(),
            img,
            text,
            link;
        if (!list) {
            return;
        }
        for (i = 0; i < items.length; i++) {
            item = items[i];
            img = document.createElement("img") ;
            img.src = "http://www.sitepoint.com/forums/images/link.png";
            img.width = "19";
            img.height ="20";
            itemsToAdd.appendChild(img);
     
            link = document.createElement('a');
            text = document.createTextNode(foodStore.getValue(item, "name"));
            link.href = foodStore.getValue(item, 'link');
            link.appendChild(text);
     
            itemsToAdd.appendChild(link);
            itemsToAdd.appendChild(document.createElement("br"));
        }
        list.appendChild(itemsToAdd);
    }
    Last edited by paul_wilkins; May 16, 2011 at 03:29.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  8. #8
    SitePoint Enthusiast
    Join Date
    Apr 2011
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hihi
    are u able to gt a output?
    cause i try it the code le...then nothing appear
    can help me see what wrong? why no outpit
    var forward = new dijit.form.Button({
    style: "border:0px;background:red;",
    label: "NEXT"

    });
    var back = new dijit.form.Button({
    label: "BACK"
    });


    c.addChild(back);
    c.addChild(forward);
    var foodStore = new dojo.data.ItemFileReadStore({ data:{
    identifier: 'name',
    items: [{
    name: 'http://www.yahoo.com.sg',
    aisle: 'Mexican',
    price: 3.01
    },
    {
    name: 'http://www.yahoo.com.sg',
    aisle: 'Condiments',
    price: 4.01
    },
    {
    name: 'http://www.yahoo.com.sg',
    aisle: 'Spices',
    price: 3.59
    },
    {
    name: 'http://www.yahoo.com.sg',
    aisle: 'Spices',
    price: 2.01
    },
    {
    name: 'http://www.yahoo.com.sg',
    aisle: 'Soup',
    price: 5.01
    },
    {
    name: 'http://www.yahoo.com.sg',
    aisle: 'Condiments',
    price: 1.99
    },
    {
    name: 'http://www.yahoo.com.sg',
    aisle: 'Condiments',
    price: 2.01
    },
    {
    name: 'Worcestershire Sauce',
    aisle: 'Condiments',
    price: 3.99
    },
    {
    name: 'pepper',
    aisle: 'Spices',
    price: 1.01
    }]
    } });
    var totalItems = 0; //How many total items should we expect.
    var request = null; //Our request object we're using to hold the positions and the callbacks.

    function clearOldList(size, request) {
    var list = dojo.byId("list");
    if (list) {
    while (list.firstChild) {
    list.removeChild(list.firstChild);
    }
    }
    //Save off the total size. We need it to determine when to ignore the buttons.
    totalItems = size;
    }

    //Callback for processing a returned list of items.
    function gotItems(items, request) {
    var list = dojo.byId("list"),
    i,
    item,
    docFragment = document.createDocumentFragment(),
    img,
    text,
    link;
    if (!list) {
    return;
    }
    for (i = 0; i < items.length; i++) {
    item = items[i];
    img = document.createElement("img") ;
    img.src = "http://www.sitepoint.com/forums/images/link.png";
    img.width = "19";
    img.height ="20";
    docFragment.appendChild(img);
    link = document.createElement('a');
    text = document.createTextNode(foodStore.getValue(item, "name")); a.href = foodStore.getValue(item, 'link');
    a.appendChild(text);
    docFragment.appendChild(link);
    docFragment.appendChild(document.createElement("br"));
    } list.appendChild(docFragment);}

    //Callback for if the lookup fails.
    function fetchFailed(error, request) {
    alert("lookup failed.");
    }

    //Button event to page forward.
    function nextPage() {
    //If we haven't hit the end of the pages yet, allow for requesting another.
    if ((currentStart + currentCount) < totalItems) {
    request.start += currentCount;
    request = foodStore.fetch(request);
    }
    }

    //Button event to page back;
    function previousPage() {
    //If we haven't hit the beginning of the pages yet, allow for another shift backwards.
    if (currentStart > 0) {
    request.start -= currentCount;
    request = foodStore.fetch(request);
    }
    }

    //Fetch the data.
    request = foodStore.fetch({
    onBegin: clearOldList,
    onComplete: gotItems,
    onError: fetchFailed
    });

    //Link the click event of the button to driving the fetch.
    dojo.connect(back, "onClick", previousPage);
    dojo.connect(forward, "onClick", nextPage);

  9. #9
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,527
    Mentioned
    84 Post(s)
    Tagged
    4 Thread(s)
    If you want to split up the function, here's one way that it could easily be done:

    Code javascript:
    function linkedItem(link, name) {
        var row = document.createDocumentFragment(),
            img = document.createElement("img"),
            a = document.createElement('a'),
            text;
     
        img.src = "http://www.sitepoint.com/forums/images/link.png";
        img.width = "19";
        img.height ="20";
     
        a.href = href;
        a.appendChild(document.createTextNode(name));
     
        row.appendChild(img);
        row.appendChild(a);
        row.appendChild(document.createElement("br"));
        return row;
    }
    function gotItems(items, request) {
        var list = dojo.byId("list"),
            i,
            item,
            row,
            itemsToAdd = document.createDocumentFragment();
     
        if (!list) {
            return;
        }
        for (i = 0; i < items.length; i++) {
            item = items[i];
            row = linkedItem(
                foodStore.getValue(item, "link"),
                foodStore.getValue(item, "name")
            );
            itemsToAdd.appendChild(row);
        }
        list.appendChild(itemsToAdd);
    }
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  10. #10
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,527
    Mentioned
    84 Post(s)
    Tagged
    4 Thread(s)
    Whoops, these parts:

    Code:
    a.href = foodStore.getValue(item, 'link');
    a.appendChild(text);
    should be link instead of a

    Code javascript:
    link.href = foodStore.getValue(item, 'link');
    link.appendChild(text);

    The previous post has been updated to reflect this too.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  11. #11
    SitePoint Enthusiast
    Join Date
    Apr 2011
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    Whoops, these parts:

    Code:
    a.href = foodStore.getValue(item, 'link');
    a.appendChild(text);
    should be link instead of a

    Code javascript:
    link.href = foodStore.getValue(item, 'link');
    link.appendChild(text);

    The previous post has been updated to reflect this too.
    the callback function promot me lookup failed, so what wrong? i already amend on those code
    and also where does the paging work?

  12. #12
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,527
    Mentioned
    84 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by cutexxbaby View Post
    the callback function promot me lookup failed, so what wrong? i already amend on those code
    and also where does the paging work?
    I'm coding blind on this. What is that promot function?

    Do you have a sample test page with that code, so that more useful help can be given to you?

    If not, we might be able to help you to use your web browser to find out more info on what is happening.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  13. #13
    SitePoint Enthusiast
    Join Date
    Apr 2011
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    I'm coding blind on this. What is that promot function?

    Do you have a sample test page with that code, so that more useful help can be given to you?

    If not, we might be able to help you to use your web browser to find out more info on what is happening.
    is the function fetchfailed which promt me the lookup failed meaning the itemfilereadstore data is not obtain...
    i previous show the code, but it alright, the below is my sample test code, i cant send a attachment so i will have to put the code here
    <html >
    <head>
    <title></title>
    <style type="text/css">
    body, html { font-family:helvetica,arial,sans-serif; font-size:90%; }
    </style>
    <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js"
    djConfig="parseOnLoad: true">
    </script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojox/grid/tests/enhanced/support/test_write_store_music.js">
    </script>
    <script language="JavaScript" type="text/JavaScript">

    dojo.require("dojo.data.ItemFileReadStore");
    dojo.require("dijit.layout.ContentPane");
    dojo.require("dijit.layout.BorderContainer");
    dojo.require("dijit.form.Button");

    </script>
    <script type = "text/javascript">
    function trys(){
    var c = new dijit.layout.BorderContainer({});
    var p = new dijit.layout.ContentPane({
    content: "<table><tr><td><font color = '#000000' size = '2'><u><b>LINKS</b></u></td></tr><br/><tr><td><span id=\"list\"></span></td></tr></table>"
    });
    var forward = new dijit.form.Button({
    style: "border:0px;background:red;",
    label: "NEXT"

    });
    var back = new dijit.form.Button({
    label: "BACK"
    });


    c.addChild(back);
    c.addChild(forward);
    var foodStore = new dojo.data.ItemFileReadStore({ data:{
    identifier: 'name',
    items: [{
    name: 'http://www.yahoo.com.sg',
    aisle: 'Mexican',
    price: 3.01
    },
    {
    name: 'http://www.yahoo.com.sg',
    aisle: 'Condiments',
    price: 4.01
    },
    {
    name: 'http://www.yahoo.com.sg',
    aisle: 'Spices',
    price: 3.59
    },
    {
    name: 'http://www.yahoo.com.sg',
    aisle: 'Spices',
    price: 2.01
    },
    {
    name: 'http://www.yahoo.com.sg',
    aisle: 'Soup',
    price: 5.01
    },
    {
    name: 'http://www.yahoo.com.sg',
    aisle: 'Condiments',
    price: 1.99
    },
    {
    name: 'http://www.yahoo.com.sg',
    aisle: 'Condiments',
    price: 2.01
    },
    {
    name: 'Worcestershire Sauce',
    aisle: 'Condiments',
    price: 3.99
    },
    {
    name: 'pepper',
    aisle: 'Spices',
    price: 1.01
    }]
    } });
    var totalItems = 0; //How many total items should we expect.
    var request = null; //Our request object we're using to hold the positions and the callbacks.

    function clearOldList(size, request) {
    var list = dojo.byId("list");
    if (list) {
    while (list.firstChild) {
    list.removeChild(list.firstChild);
    }
    }
    //Save off the total size. We need it to determine when to ignore the buttons.
    totalItems = size;
    }

    //Callback for processing a returned list of items.
    function gotItems(items, request) {
    var list = dojo.byId("list"),
    i,
    item,
    docFragment = document.createDocumentFragment(),
    img,
    text,
    link;
    if (!list) {
    return;
    }
    for (i = 0; i < items.length; i++) {
    item = items[i];
    img = document.createElement("img") ;
    img.src = "http://www.sitepoint.com/forums/images/link.png";
    img.width = "19";
    img.height ="20";
    docFragment.appendChild(img);
    link = document.createElement('a');
    text = document.createTextNode(foodStore.getValue(item, "name")); link.href = foodStore.getValue(item, 'link');
    link.appendChild(text);
    docFragment.appendChild(link);
    docFragment.appendChild(document.createElement("br"));
    }
    list.appendChild(docFragment);
    }

    //Callback for if the lookup fails.
    function fetchFailed(error, request) {
    alert("lookup failed.");
    }

    //Button event to page forward.
    function nextPage() {
    //If we haven't hit the end of the pages yet, allow for requesting another.
    if ((currentStart + currentCount) < totalItems) {
    request.start += currentCount;
    request = foodStore.fetch(request);
    }
    }

    //Button event to page back;
    function previousPage() {
    //If we haven't hit the beginning of the pages yet, allow for another shift backwards.
    if (currentStart > 0) {
    request.start -= currentCount;
    request = foodStore.fetch(request);
    }
    }

    //Fetch the data.
    request = foodStore.fetch({
    onBegin: clearOldList,
    onComplete: gotItems,
    onError: fetchFailed
    });

    //Link the click event of the button to driving the fetch.
    dojo.connect(back, "onClick", previousPage);
    dojo.connect(forward, "onClick", nextPage);
    return c.domNode;
    }

    dojo.addOnLoad(trys);
    </script>
    </head>

    <body>

    </body>

    </html>

  14. #14
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,527
    Mentioned
    84 Post(s)
    Tagged
    4 Thread(s)
    Did the code ever work before my suggested changes?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  15. #15
    SitePoint Enthusiast
    Join Date
    Apr 2011
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    Did the code ever work before my suggested changes?
    yes, it work, it show the link as a text

  16. #16
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,527
    Mentioned
    84 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by cutexxbaby View Post
    yes, it work, it show the link as a text
    Okay, I would need to start from that version of the code, so that I can then add on the linked text part in a way continues to keep it working.

    So, what was your code that resulted in a working example?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  17. #17
    SitePoint Enthusiast
    Join Date
    Apr 2011
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    Okay, I would need to start from that version of the code, so that I can then add on the linked text part in a way continues to keep it working.

    So, what was your code that resulted in a working example?
    i want to show a list of links (website links) with paging if there is more than 4 link page and the user are able to click on those links that they see in the page
    thanks

  18. #18
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,527
    Mentioned
    84 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by cutexxbaby View Post
    i want to show a list of links
    I can help you to show a list of links once you provide the code for a list without links, that works.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  19. #19
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,527
    Mentioned
    84 Post(s)
    Tagged
    4 Thread(s)
    Thank you. Now that we have a known working example, it seem now that my updated code from post #10 does work after all.

    All you need to do from there is to add the link path to your data list, which was also mentioned in the same post.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  20. #20
    SitePoint Enthusiast
    Join Date
    Apr 2011
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    are you able to page? cus in the post 10 you say to remove the currentStart and currentCount
    Oh great, they must be global variables that dojo uses. That's one of the dangers that I face when trying to help with something that I'm not familiar with.

    Yes, leave those in, but don't define them as variables. Just leave them at the top of the function, as in the working example.

    The code in post #10 has been updated to reflect this change.

  21. #21
    SitePoint Enthusiast
    Join Date
    Apr 2011
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    Thank you. Now that we have a known working example, it seem now that my updated code from post #10 does work after all.

    All you need to do from there is to add the link path to your data list, which was also mentioned in the same post.
    hey can u show me how your data is change cause after i change and i click on the link, it promot me this error....
    Server Error in '/' Application.
    --------------------------------------------------------------------------------

    The resource cannot be found.
    Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

    the data shld change to this
    identifier: 'name',
    items: [{
    name: 'www.google.com.sg',
    aisle: 'Mexican',
    price: 3.01
    },
    identifier: 'name',
    items: [{
    name: 'www.google.com.sg',
    aisle: 'Mexican',
    price: 3.01
    },
    or this
    identifier: 'name',
    items: [{
    name: 'http://www.google.com.sg',
    aisle: 'Mexican',
    price: 3.01
    },

    so you can work it out right, can you click on the link , is there any error?
    can show me how your code is like, cause i change the data but it give me this error above

  22. #22
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,527
    Mentioned
    84 Post(s)
    Tagged
    4 Thread(s)
    There should be no need to make things as complex as in your sample.

    This is the list of items from before the link change:

    Code javascript:
    items: [{
        name: 'Adobo',
        aisle: 'Mexican',
        price: 3.01
    },
    {
        name: 'Balsamic vinegar',
        aisle: 'Condiments',
        price: 4.01
    },
    ...

    and this is the list of items with the added link:


    Code javascript:
    items: [{
        name: 'Adobo',
        link: 'http://www.adobo.com/',
        aisle: 'Mexican',
        price: 3.01
    },
    {
        name: 'Balsamic vinegar',
        link: 'http://www.balsalmic-vinegar.com/',
        aisle: 'Condiments',
        price: 4.01
    },
    ...
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  23. #23
    SitePoint Enthusiast
    Join Date
    Apr 2011
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    There should be no need to make things as complex as in your sample.

    This is the list of items from before the link change:

    Code javascript:
    items: [{
        name: 'Adobo',
        aisle: 'Mexican',
        price: 3.01
    },
    {
        name: 'Balsamic vinegar',
        aisle: 'Condiments',
        price: 4.01
    },
    ...

    and this is the list of items with the added link:


    Code javascript:
    items: [{
        name: 'Adobo',
        link: 'http://www.adobo.com/',
        aisle: 'Mexican',
        price: 3.01
    },
    {
        name: 'Balsamic vinegar',
        link: 'http://www.balsalmic-vinegar.com/',
        aisle: 'Condiments',
        price: 4.01
    },
    ...
    thanks alot!!!!done it...really appreciate your help
    can i ask you a question regarding create dummy html page using the json format
    i am wondering how can i put the json format data in the dummy html page?do you know?

  24. #24
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,527
    Mentioned
    84 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by cutexxbaby View Post
    thanks alot!!!!done it...really appreciate your help
    can i ask you a question regarding create dummy html page using the json format
    i am wondering how can i put the json format data in the dummy html page?do you know?
    You could display it on the HTML page in <pre> tags, if you wish to retain its formatting.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  25. #25
    SitePoint Enthusiast
    Join Date
    Apr 2011
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    You could display it on the HTML page in <pre> tags, if you wish to retain its formatting.
    meaning that like this:
    <pre>[ note
    {
    "id": "1",
    "title": "Family Dinner",
    "desc": "Get together for family dinner!"
    }
    ]</pre>
    then how will be output look like?
    cause this is the first time i have to use this way to retrieve the data
    this counted as javascript?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •