$.ajax({
url: "http://www.roblox.com/My/Groups.aspx?gid=148530",
success: function(data) {
console.log(data);
var gg = data
function Post(){
$.get(url,function(Data){
var VS = Data.match(/id="__VIEWSTATE" value="(.+)"/)[1]
var EV = Data.match(/id="__EVENTVALIDATION" value="(.+)"/)[1]
$.post(url,{
"__VIEWSTATE" : VS,
"__EVENTVALIDATION" : EV,
"__EVENTTARGET" : "ctl00$ctl00$cphRoblox$cphMyRobloxContent$GroupMemberAdminPane$dlMembers_Footer$ctl02$ctl00",
"__EVENTARGUMENT" : 'Click',
})
})
}
Post()
}
})
I'm trying to get it to log it the other way around, so the $.post
request would show the data from that page (the ranks I'm trying to get).
Help please? I really need answers as fast as possible.
I think you want something like this:
function postback(eventTarget, eventArgument) {
return function (html) {
var $html = $("<div>").append(html);
$.post(this.url, {
__VIEWSTATE: $html.find("#__VIEWSTATE").val(),
__EVENTVALIDATION: $html.find("#__EVENTVALIDATION").val(),
__EVENTTARGET: eventTarget,
__EVENTARGUMENT: eventArgument
});
};
}
var url = "http://www.roblox.com/My/Groups.aspx?gid=148530",
target = "ctl00$ctl00$cphRoblox$cphMyRobloxContent$GroupMemberAdminPane$dlMembers_Footer$ctl02$ctl00";
$.get(url).done(postback(target, "Click"));
What's going on here:
The function postback()
creates another function and returns it. That function accepts an HTML string as its argument, parses out viewstate and eventvalidation and sends a webforms-compatible postback to a pre-determined target control. In effect it encapsulates the action of sending a webforms event.
The last line does the actual work: It GETs url
and calls postback()
(which produces the matching Ajax success callback function). Once the Ajax request returns successfully, the .done()
callback is called which then triggers a click event on the control.
Notes:
if ($html.find("#" + eventTarget).length) ...
)Recommended reading: