1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[HELP] Slice and Split Problem in Javascript

Discussion in 'HTML & JavaScript' started by VIC SEO, Jun 25, 2011.

  1. VIC SEO

    VIC SEO Elite Member

    Joined:
    Feb 19, 2010
    Messages:
    2,156
    Likes Received:
    363
    Gender:
    Male
    Occupation:
    SEO Specialist
    Location:
    iSynergyMedia
    Home Page:
    Hello,
    I'm converting a HTML/PHP website to wordpress. I'm showing real estate listings on the Google Maps. I've been able to sort out all the problem when converting to wordpress but I'm stuck at a point.

    Here is the code;

    Code:
    parameters: function() {
    				var result = {};
    				var url = window.location.href;
    				var parameters = url.slice(url.indexOf('?') + 1).split('&');
     		
    				for(var i = 0;  i < parameters.length; i++) {
    					var parameter = parameters[i].split('=');
    					result[parameter[0]] = parameter[1];
    				}
    				return result;
    			}
    
    Here are the details;

    The page URL is http://domain.com/?page_id=113
    I'm doing the AJAX requests to show the listings according to visitor's defined fields.
    Actually, the requests will be made like this;
    http://domain.com/?page_id=113&low=123&high=324 etc

    In my previous script, it was http://domain.com/result.php?low=123&high=324

    Now how can I do it in wordpress using slice and split.


    Any kind of help will be really appreciated.

    Regards