Update get_pages using ajax on form select change

Your Javascript is loading the whole page anyway, since you are sending a request to the_permalink. If you are going to do that just reload the page.

First, your should be using the AJAX API. There are a couple of steps but it isn’t that hard. See the Codex to get started.

In your callback you only want to run the line that gets the $pages variable and then whatever processing is necessary to format your results. Return that formatted content as a string. Then use your jQuery to replace the apprpriate part of the page with the new content. There are several jQuery functions for doing that.