Reputation: 12335
I have not used jquery much yet and not very familiar with it.
Trying to do the below:
// JavaScript Document
$(document).ready(function()
{
$('#day').change (function ()
{
//next to lines work here but not if placed after $.get
var day = $('#day').val() ;
$("#test").html(day);
$.get('http://www.sharingizcaring.com/schedule/menutest.php', { day: $('#day').val() },
function(data)
{
$("#test").html( data );
});
});
});
Setting the .html to blah blah works.. But if I switch actions to use the value of the select item #day
day is a <select>
tag.
Also the code works correctly above the $.get() function.
It does not work.
Upvotes: 0
Views: 664
Reputation: 558
Could be the problem with the url you are sending a request to. I think it should be the same domain s the page, otherwise it wont work. Also, try using Firebug to see if requests get sent and what is returned. Firebug is realy helpfull.
Upvotes: 1
Reputation: 532465
Ordinarily, I would expect that you would set the value on return to something you got back from the server. To do that you need to add a parameter to your callback function and reference the value on it. I'm going to assume that your menutest method returns HTML containing the "new" day input.
$.get('http://www.sharingizcaring.com/schedule/menutest.php',
{ day: $('#day').val() },
function(data) {
$("#test").html( data );
}
);
Upvotes: 1