The program is supposed to be a live search using php and javascript... where as you type it searches below. I just recently started learning javascript so sorry if my knowledge is limited...

```js
$(document).ready(function () {
    $('#results').append('<p>Started</p>');
    var getText = (function () {
        return document.getElementById('year').value;
    });
    var text = getText;
    var getText1 = (function () {
        return document.getElementById('class').value;
    });
    var text1 = getText1;
    setInterval(function () {
        var newText = getText;
        var newText1 = getText1;
        var loading = "search.php?year=" + newText + "&class=" + newText1;
        $('#results').append(newText1);
        if (text !== newText || text1 !== newText1) {
            $('#results').load(loading);
            $('#results').append('somethinghappened');
        };
        text = newText;
        text1 = newText1;
    }, 100);
});

```

so it works fine when i append newText1, however if i try to append "loading" it returns:

> 
> search.php?year=function () { return document.getElementById("year").value; }&class=function () { return document.getElementById("class").value; }
> 
> 
> 

Can anyone explain what the difference between the two cases is and why a difference occurs? and possibly how to fix it so that it loads the correct URL

i searched and found: [JavaScript: When assigning an anonymous function to a variable, function return value is not passed, rather the function as a string](https://stackoverflow.com/questions/2301851/javascript-when-assigning-an-anonymous-function-to-a-variable-function-return) however didn't quite understand completely what it meant by passing two arguments, and when i tried to do something similar, it didn't work as expected... 

Any help is appreciated and thanks in advance.