Solved

getOwnPropertyNames in IE

Posted on 2014-01-30
2
536 Views
Last Modified: 2014-01-30
Hi,

I am using these functions to check the querystring for parameters and their values and then loop through and pass them to another function.
However, IE doesn't like getOwnPropertyNames. Is there an alternative I can use?

setTrackParams = function(){
	var params = qbtbUS.getUrlVars();
	var forms = $("form");

	if(typeof Object.getOwnPropertyNames(params).length !== 0){
		$.each( forms, function( key, value ) {
			qbtbUS.createSubmitFields(value, params);
		});
	}
}

getUrlVars = function() {
	var search = window.location.search;
    var params = {};
	if (search.charAt( 0 ) == '?' ) {
		search = search.substring(1);
        var hashes = search.split('&');
        var i,len = hashes.length;
        for(i = 0; i < len; i+=1) {
          hash = hashes[i].split('=');
          params[hash[0]] = hash[1];
	 }
  }
  return params;
}

Open in new window

0
Comment
Question by:Al4ddin2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39820730
Try this :
setTrackParams = function(){
	var params = qbtbUS.getUrlVars();
	var forms = $("form");

	var l = 0;
	for(var i in params) l++;
	if(l) {
		$.each( forms, function( key, value ) {
			qbtbUS.createSubmitFields(value, params);
		});
	}
}

Open in new window

0
 
LVL 82

Expert Comment

by:leakim971
ID: 39820791
Another one :
setTrackParams = function(){
	var params = qbtbUS.getUrlVars();
	var forms = $("form");

	for(var i in params) break;
	if(i) {
		$.each( forms, function( key, value ) {
			qbtbUS.createSubmitFields(value, params);
		});
	}
}

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question