function get_url_param(http_url, name) {
var reg = new RegExp("(^|[&,?])" + name + "=([^&]*)(&|$)");
var r = http_url.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
var my_url = 'http://www.ab.com/index.php/index/index/?user_id=2312';
var user_id = get_url_param(my_url, 'user_id');
alert(user_id);