Ryler Sexton
Ryler Sexton

Reputation: 153

http request AJAX

Hi I'm having a bit of a problem with my code I'm trying to test if this line of code(ajaxmaprequest.js)is working making it retrieve a string from xmlspitquery.php and echo it at testajax.php. Would appreciate any help on what I'm doing wrong.

ajaxmaprequest.js

$ ('#lgu','#category','#type').change(function(){
    var Lgu = $('#lgu').val();
    var Category = $('#category').val();
    var Type = $('#type').val();

    $.get('xmlspitquery.php',
         { input: Lgu, input2: Category, input3: Type}, 
         function(data) {
            $('#xmlreturn').text(data);
    });
});

And this is from testajax.php

<select id="lgu" name="Lgu">
    <option>LGUs</option>
    <option>Bacolod City</option>
    <option>Bago City</option>
    <option>Cadiz City</option>
</select>

<select id="category" name="Category">
    <option>Categories</option>
    <option>Hotel</option>
    <option>Restaurant</option>
    <option>Attractions</option>
</select>

<select id="type" name="Type">
    <option>Tourism Type</option>
    <option>Eco</option>
    <option>Resto</option>
    <option>Fun</option>
</select>

<div id="xmlreturn"> </div>

xmlspitquery.php

only has echo "Test"; I will add more code once i get the connection done.

Upvotes: 1

Views: 118

Answers (1)

Zemistr
Zemistr

Reputation: 1049

Change this:

$('#lgu','#category','#type')

to this:

$('#lgu,#category,#type')

Upvotes: 3

Related Questions