a developer's notes – a semi-technical web development BLOG

April 11, 2013

Parsing a Query String into an array with JavaScript

Filed under: Javascript / JQuery — Duy Nguyen @ 9:50 pm
Tags: , , , , , , , , ,

This brilliant method belongs to Joe Zim’s JavaScript Blog.

Here is the function.

    var parseQueryString = function( queryString ) {
        var params = {}, queries, temp, i, l;
     
        // Split into key/value pairs
        queries = queryString.split("&");
     
        // Convert the array of strings into an object
        for ( i = 0, l = queries.length; i < l; i++ ) {
            temp = queries[i].split('=');
            params[temp[0]] = temp[1];
        }
     
        return params;
    };

Using the function.

   function Test() {
        var qstring = "apple=7sf&orange=242&bananna=47614&cherry=8139";
        var myNewArray = parseQueryString(qstring);
    }

As you can see, you now have an array of all of your query strings!

parseQstring

Advertisements

September 5, 2011

There Is No Source Code Available For the Current Location

Filed under: ASP.NET — Duy Nguyen @ 2:25 pm
Tags: , , , , , , , , , , , , , ,

(Taken from:http://www.marvinpalmer.com/MarvinPalmer/post/There-Is-No-Source-Code-Available-For-the-Current-Location.aspx

When using trying to debug with Visual Studio and programming using .NET, you get a Visual Studio dialog that says “There is no source code available for the current location.”

1.The “Show Disassembly” button will be available. Click on it. You can step through the disassembly which does eventually take you into the code.
2. If you click “Show Disassembly” and then “Step Into” code (F11) just like you would have if the code window had loaded, you will see code mixed with other stuff.
3. When you see the code to debug, just right-click the window and choose “Go to Source Code” which opens up the code

Blog at WordPress.com.