I am attaching the saved html of a usage report. Basically, it gives you daily usage by date. I needed a better data like the accumulated usage for the month to date of subscription, AND the percentage of quota use ..etc..
I wrote jquery to do that. My first attempt is here:

var arr = {};
var duse;
var tday;
var usesofar=0;

$('#ctl00_ContentPlaceHolder1_TD_Unlimited_Usage_PerDay tr').each(function() {
    duse = $(this).find("td").eq(3).html();
    tday = $(this).find("td").eq(0).html();
           console.log(tday);
           console.log(duse);

           arr[tday] = duse;
});

$.each(arr, function (index, value) {
   //console.log( index + ' : ' + value );
  if(/GB/g.test(value)){usesofar += parseFloat(value);}

});
alert (usesofar);

I need your help in doing it right.

  1. This is a secured site I have to login.
  2. once I am in how can I use my jquery to display the report in a window.
  3. Is it possible to automate this proceedure and email me with the report ?

I did it in Perl but I feel jquery could be a better solution.. What do you think?

Recommended Answers

All 2 Replies

You cannot purely do it from the client side (JQuery) if you need to read data from the server. Further more, you could use Ajax with JQuery, but you still need to implement authentication/authorization with your server.

If you already use Perl, keep using it. Web display is just a design. You could also implement a Perl script to generate a webpage for you anyway (but manually). It is better to do it that way. Yes, you can automate the email part using Perl as well. Just implement a Perl script that create & send an email to whatever email you want, leave it in your server, and then you could use cron to call the script for you.

Sorry for the delayed response, and thank you for your response. You are right; my approach is rather odd, and this is because I am new in the web design 'arena'...
If you have time to handhold me a bit, I still feel that it is possible to do it. In principle you receive a page and you want to massage it a bit. In my situation I am using Firefox and nothing else. Greasemonkey was created to do just that, I mean apply some javascript to get what you want from your local copy of the page. I can show you what I did so far, but if you have experience with this approach, or anyone reading this post; I can post the code. If I can show you that I can process the page and get the data I calculated; can you help me in automating it ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.