fetching data from html fields
by Fernando De Leon
HTML
<a href="viewBlog.action?metaData.siteID=1043&metaData.channelId=9&metaData.blogCategoryID=0&metaData.blogID=18">asd</a>
<button id="b">
Press here
</button>
JavaScript
var str = "viewUserProfile(9, 114, 1043,'_top')";
var blob = "throw 'allowScriptTagRemoting is false.';//#DWR-INSERT//#DWR-REPLYdwr.engine._remoteHandleCallback('3','0',\"\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\t\r\n\t\t<!-- New comment will post here -->";
var someHtml = "<div id='a'><div id='childOfA'>child</div> </div><div id='c'>Goo</div>";
$("a").on("click",function(evt) {
//console.log(blob);
evt.preventDefault();
var href = $(this).attr('href');
console.log("The href:"+href);
var arr = href.split("&metaData.");
console.log(arr);
var cDiv = $(someHtml).filter("#c");
var childA = $(someHtml).find("#childOfA");
console.log($(someHtml));
console.log(cDiv);
console.log(childA);
arr.forEach(function(ele,index) {
console.log("the ele is:"+ele);
var arr2 = ele.split("=");
if(arr2.length === 2 && arr2[0] === "blogID") {
console.log("the blogID is:"+arr2[1]);
}
});
});
$("#b").on("click",function(evt) {
var arr = str.split(',');
console.log(arr);
});