Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Unobtrusive scripting is fun!

Unobtrusive scripting is fun!

Scheduled Pinned Locked Moved The Lounge
javascripthtmlcomdesign
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BobJanova
    wrote on last edited by
    #1

    I recently went to QCon, and one of the many excellent talks there was about how we should be writing web applications. Among many other things, he said that we should use unobtrusive scripting (i.e. make the page usable even if it's turned off, and then enhance things live). So I'm trying to do that with the cricket club website I've taken over. And you know, it's actually kind of fun writing JavaScript to muck about with the DOM to do UI-enhancing things :^) (So far I have: <a> tags can get enhanced to be AJAX grabs, instead of a page jump; <form>s can be enhanced to do an AJAX POST; and <div>s can be enhanced to be hidden but provide a show/hide link, for the kind of threaded comments page like what they do here.)

    F B 2 Replies Last reply
    0
    • B BobJanova

      I recently went to QCon, and one of the many excellent talks there was about how we should be writing web applications. Among many other things, he said that we should use unobtrusive scripting (i.e. make the page usable even if it's turned off, and then enhance things live). So I'm trying to do that with the cricket club website I've taken over. And you know, it's actually kind of fun writing JavaScript to muck about with the DOM to do UI-enhancing things :^) (So far I have: <a> tags can get enhanced to be AJAX grabs, instead of a page jump; <form>s can be enhanced to do an AJAX POST; and <div>s can be enhanced to be hidden but provide a show/hide link, for the kind of threaded comments page like what they do here.)

      F Offline
      F Offline
      Forogar
      wrote on last edited by
      #2

      If you haven't already you should check out jQuery[^] and especially JQuery-UI[^] if you like doing UI kind of things.

      - I would love to change the world, but they won’t give me the source code.

      B 1 Reply Last reply
      0
      • F Forogar

        If you haven't already you should check out jQuery[^] and especially JQuery-UI[^] if you like doing UI kind of things.

        - I would love to change the world, but they won’t give me the source code.

        B Offline
        B Offline
        BobJanova
        wrote on last edited by
        #3

        I'm aware of jQuery, thanks (is there anyone who does web stuff that isn't?). I actually had to use some pieces of it for Real Work at the back end of 2011 (its date/time picker). I'm having fun working things out myself, though. I don't really like using frameworks if I don't have to, and since this is not really work, I don't have to. (Yet :P.)

        1 Reply Last reply
        0
        • B BobJanova

          I recently went to QCon, and one of the many excellent talks there was about how we should be writing web applications. Among many other things, he said that we should use unobtrusive scripting (i.e. make the page usable even if it's turned off, and then enhance things live). So I'm trying to do that with the cricket club website I've taken over. And you know, it's actually kind of fun writing JavaScript to muck about with the DOM to do UI-enhancing things :^) (So far I have: <a> tags can get enhanced to be AJAX grabs, instead of a page jump; <form>s can be enhanced to do an AJAX POST; and <div>s can be enhanced to be hidden but provide a show/hide link, for the kind of threaded comments page like what they do here.)

          B Offline
          B Offline
          Brady Kelly
          wrote on last edited by
          #4

          BobJanova wrote:

          <form>s can be enhanced to do an AJAX POST

          I am currently busy with trying to find a mechanism to make a non-form, i.e. a sub-form (not allowed, but is a group of inputs and a URL) post via AJAX.

          M 1 Reply Last reply
          0
          • B Brady Kelly

            BobJanova wrote:

            <form>s can be enhanced to do an AJAX POST

            I am currently busy with trying to find a mechanism to make a non-form, i.e. a sub-form (not allowed, but is a group of inputs and a URL) post via AJAX.

            M Offline
            M Offline
            Moykn
            wrote on last edited by
            #5

            Brady Kelly wrote:

            I am currently busy with trying to find a mechanism to make a non-form, i.e. a sub-form (not allowed, but is a group of inputs and a URL) post via AJAX.

            You could just create a JSON and pass it to the server in the "data" field of a jQuery.ajax request. If you are using C# with Webservices you could do this: (Using jQuery)

            $.ajax({
            url: "your.url.here/Method",
            type: "POST",
            data: {json:{a:10,b:20}},
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
            var response = $.parseJSON(data.d);

                       }
            

            });

            wich in server will be

            public string Method(object json){
            //do your stuff here
            }

            or

            $.ajax({
            url: "your.url.here/Method",
            type: "POST",
            data: {a:10,b:20},
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
            var response = $.parseJSON(data.d);

                       }
            

            });

            and server-side

            public string Method(int a, int b){
            //do your stuff here
            }

            Sorry, my english is bad!

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups