how to load a div into html using jquery

I'm trying to load a div into a page based on a change in the drop down. I either want to show a div which has state/zip or province/postal_code, (each is a file) but I am getting a "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 loss, what should be in my "residency method"? what to put in my routes file?
I'd suggest not using selectedText and instead using the "value" property of the dropdown, its safer this way since you text can change (to "USA" for instance) without affecting your code.

以上就是how to load a div into html using jquery的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准