How to load div in html using jquery
I am trying to load a div into a page based on a dropdown change. I either want to show a div that has state / zip or province / postal_code (each file), but I get "406 Not Acceptable [ http: // localhost / profiles / residency] "
Here is my JQuery code:
$(function(){
$("#profile_country").change(onSelectChange);
});
function onSelectChange() {
var selected = $("#profile_country option:selected");
var selectedText = selected.text();
if (selectedText == 'United States') {
$("#residency").load("/profiles/residency");
}
else {
$("#residency").load("/profiles/residency");
}
}
Now I am at a loss, what should be in my "stay method"? what to add to the routes file?
A 406 Not Acceptable
means that the Content-Type
data returned is not of the type defined in the header Accept
. I suggest you use Firebug for further searching.
More information from W3C HTTP / 1.1 Status Code Definitions
source to share
The problem could be with the Content-Type of your request: The 406 error is usually related to Accept headers, so I'm guessing jquery is requesting a specific content type that doesn't match what the webserver gives ...
Take a look at the headers you send when you call your url. You may need to change the filename to ".html"
source to share