1

Is there a way to send ajax requests in a Java program? I was thinking that there might be a jquery library somewhere, but I don't even know if jquery would be something that I should use. I'm trying to get the data from a certain request from a website as shown in this function:

function searchFraze(fraze, page) {
    page = typeof page !== 'undefined' ? page : 1;
    $.ajax({
        url: 'ajax/tradeCsRight.php',
        type: 'POST',
        data: "search=1&type=10&fraze="+fraze+"&page="+page,
        success: function(data) {
            $("#itemlist").html(data);
        }
    });
}

Basically, I want to POST custom data in the data field above to the website (http://csgolounge.com/). Honestly, I don't even know if I should be doing what I'm doing this way, or if I should use some other method.

Also, in FireBug, I can see the contents of the tradeCsRight.php file as seen here (which is my goal, to see the html content of this): https://i.stack.imgur.com/Ix0F1.png If I open the actual file in chrome, however, the page and html is blank (https://i.stack.imgur.com/CbMU8.png). Can someone tell me why this is?

daltonv297
  • 161
  • 5
  • 14
  • [Java isn't JavaScript.](http://stackoverflow.com/questions/245062/whats-the-difference-between-javascript-and-java) – James Taylor May 23 '15 at 01:49
  • @JamesTaylor Yes, I realize that. That's why I'm asking this question. – daltonv297 May 23 '15 at 01:52
  • Well, you can't send AJAX requests in Java, because AJAX is "Asynchronous *JavaScript* and XML". – TimoStaudinger May 23 '15 at 02:01
  • @TimoSta Ok. I've already written half my program in java and I need this in order for the whole thing to work. Do you have any suggestions about how I would achieve my goal then? I can make edits if something is unclear. – daltonv297 May 23 '15 at 02:03
  • 3
    Well, you can send HTTP requests in Java. I assume that this is basically what you want? [This article](http://www.mkyong.com/java/how-to-send-http-request-getpost-in-java/) might give you an idea. – TimoStaudinger May 23 '15 at 02:05

0 Answers0