Q:

Ajax Get not working?

function submitForm()
{
    $.ajax({
        type: 'GET', 
        url: 'iccrefresh.php', 
        data: $('this').serialize(),
        dataType:'script',
        error: function()
                { $( "#dialog_error" ).dialog( "open" ); },
        success: function()
                { $( "#dialog_success" ).dialog( "open" ); }
            });
    return false;
}

In Php
echo "<form name='refresh' onsubmit='return submitForm();'>";
echo "<input type='hidden' name='team1' value=$teamx />";
echo "<input type='hidden' name='team2' value=$teamy />";
echo "<input type='submit' name='submit' align='middle' value='Refresh Match Score'/>";
echo "</form>";

Is there any reason why I am not able to send team 1 and team 2 across? I am getting a success message, but iccrefresh is unable to access team 1 and team 2 values?

A:

there doesn't exists a tag with the name this. You have to write $(this) instead of $('this')...
But this is also wrong here, you have to pass the this (the element) into the function and then use it as "selector":
function submitForm(form)
{
    $.ajax({
        type: 'GET', 
        url: 'iccrefresh.php', 
        data: $(form).serialize(),
        dataType:'script',
        error: function()
                { $( "#dialog_error" ).dialog( "open" ); },
        success: function()
                { $( "#dialog_success" ).dialog( "open" ); }
            });
    return false;
}

And in PHP:
echo "<form name='refresh' onsubmit='return submitForm(this);'>";
echo "<input type='hidden' name='team1' value='$teamx' />";
echo "<input type='hidden' name='team2' value='$teamy' />";
echo "<input type='submit' name='submit' align='middle' value='Refresh Match Score'/>";
echo "</form>";

