samedi 16 juillet 2016

Split string with brace to become parameter


If I have a input value "a[123],b[456],c[789]" and I want to return as "a=123&b=456&c789"

I've tried below code but no luck.. Is there a correct way to implement this?

var str = "a[123],b[456],c[789]"
var string = (str).split(/[|,|]/);

alert(string);

Aucun commentaire:

Enregistrer un commentaire