Menu

Get info using AJAX

Help
Chacaman
2014-01-29
2014-02-04
  • Chacaman

    Chacaman - 2014-01-29

    hi, guys thanks for your time and help
    i tryn to get data from phpinfo using ajax but is not working for my this is my code:

    $.ajax({
    type: "GET",
    dataType: 'json',
    data: {},
    url: 'resources/phpinf/xml.php?plugin=complete&jsonp&callback=?',
    async: false,
    success: dojo.hitch(this, function(json) {
    window.alert(json.Distro);
    window.alert(json);
    })
    });

    some body can check this code?

    thanks

     
  • Mieczysław Nalewaj

    Try new version from github ( https://github.com/rk4an/phpsysinfo )

     
  • Chacaman

    Chacaman - 2014-01-29

    Thanks for your time and help i donwload the phpsysinfo from github but i have the same problem using ajax
    phpSysInfo - 3.1.8

    1 first test
    $.ajax({
    type: "GET",
    url: "http://192.168.3.145/xml.php?plugin=complete&jsonp&callback=?",
    dataType: "jsonp",
    success: function(jsonp) {
    alert(jsonp.Hostname);
    },
    error: function() {
    alert("An error occurred while processing jsonp web.");
    }

    });

    on alert i get undefined

    2 second test

    $.ajax({
    type: "GET",
    url: "http://192.168.3.145/xml.php?plugin=complete&jsonp&callback=?",
    dataType: "json",
    success: function(json) {
    alert(json.Hostname);
    },
    error: function() {
    alert("An error occurred while processing jsonp web.");
    }

    });

    on alert i get undefined

    3 test number tree

    $.ajax({
    type: "GET",
    url: "http://192.168.3.145/xml.php?plugin=complete&json&callback=?",
    dataType: "json",
    success: function(json) {
    alert(json.Hostname);
    },
    error: function() {
    alert("An error occurred while processing jsonp web.");
    }

    });

    i get An error occurred while processing jsonp web.

    i test de url and is working
    example

    {"Generation":{"@attributes":{"version":"3.1.x","timestamp":"1391030580"}},"Options":{"@attributes":{"tempFormat":"c","byteFormat":"auto_binary","refresh":"60000","threshold":"90","showPickListTemplate":"true","showPickListLang":"true"}},"UsedPlugins":{},"Vitals":{"@attributes":{"Hostname":"BDIWM01","IPAddr":"192.168.3.145","Kernel":"3.2.0-23-generic (SMP) x86_64","Distro":"Ubuntu 12.04.4 LTS","Distroicon":"unknown.png","Uptime":"1378910.31","Users":"1","LoadAvg":"1.16 1.02

     

    Last edit: Chacaman 2014-01-30
  • Mieczysław Nalewaj

    Change line in first test:
    from:
    alert(jsonp.Hostname);
    to
    alert(jsonp.Vitals['@attributes'].Hostname);

     
  • Chacaman

    Chacaman - 2014-01-31

    !nice is working thanks for your time and help and this great job!

     
  • Chacaman

    Chacaman - 2014-02-04

    Hi, thanks for your time and help one more question i try this
    var CpuM = ((jsonp.CPU['@attributes'].Model)); = no result
    var CpuM = ((jsonp.CPU.CpuCore['@attributes'].Model)); = no result

     
  • Mieczysław Nalewaj

    Try jsonp.Hardware['CPU']['CpuCore'][0]['@attributes'].Model
    Look at xml (http://192.168.3.145/xml.php?plugin=complete) for further help.

     

    Last edit: Mieczysław Nalewaj 2014-02-04