I'm not sure is it possible but I need something like this
- pass argument to my html file (e.g a.html?status=failed)
- somehow process this value by jquery to change select value
I'm not sure is it possible but I need something like this
Using URL Parser jQuery plugin
$(document).ready(function(){
var valuePassed=$.url().param('status');
$('#select').val(valuePassed);
});
or with vannila javascript helper function explained in How can I get query string values in JavaScript?
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" :
decodeURIComponent(results[1].replace(/\+/g, " "));
}
$(document).ready(function(){
var valuePassed=getParameterByName('status');
$('#select').val(valuePassed);
});