Build query string from parameters object

There is a nice solution as of 1.4+. You can build a query string from a parameters object with $httpParamSerializer : var qs = $httpParamSerializer(params); See docs here Default $http params serializer that converts objects to strings according to the following rules: {‘foo’: ‘bar’} results in foo=bar {‘foo’: Date.now()} results in foo=2015-04-01T09%3A50%3A49.262Z (toISOString() and encoded … Read more

How to pass an array within a query string?

Here’s what I figured out: Submitting multi-value form fields, i.e. submitting arrays through GET/POST vars, can be done several different ways, as a standard is not necessarily spelled out. Three possible ways to send multi-value fields or arrays would be: ?cars[]=Saab&cars[]=Audi (Best way- PHP reads this into an array) ?cars=Saab&cars=Audi (Bad way- PHP will only … Read more

How to get URL parameter using jQuery or plain JavaScript?

Best solution here. var getUrlParameter = function getUrlParameter(sParam) { var sPageURL = window.location.search.substring(1), sURLVariables = sPageURL.split(‘&’), sParameterName, i; for (i = 0; i < sURLVariables.length; i++) { sParameterName = sURLVariables[i].split(‘=’); if (sParameterName[0] === sParam) { return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); } } return false; }; And this is how you can use … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)