socialforge/app/views/school/index.html.erb

100 lines
2.2 KiB
Plaintext

<% port = ":3000" if Rails.env.development? %>
<script type="text/javascript">
$(document).ready(function() {
$("#province").html("<option value='0' selected = true style='display: none;'></option>");
$.ajax({
type :"POST",
url :'/school/get_province',
data: "send",
success: function(data, textStatus){
$("#province").append(data.text);
$("#schoollist").html(data.text_s);
}
})
});
</script>
<script type="text/javascript">
function get_school(value){
$.ajax({
type :"POST",
url :'/school/get_schoollist/'+encodeURIComponent(value),
data :'text',
success: function(data){
$("#schoollist").html(data);
//$("#schoollist").html(data);
}
}
)
}
</script>
<script type="text/javascript">
function test(id){
location.href = encodeURI('http://course.trustie.net/?school_id='+id);
}
</script>
<script type="text/javascript">
function ssearch(){
//alert($("#key_word").val());
var value = $("#key_word").val();
var province = $("#province").val();
//alert(value);
if(value == "")
{
alert("搜索条件不能为空");
return;
}
//alert(province);
$.ajax({
type :"POST",
url :'/school/search_school/?key_word='+encodeURIComponent(value)+'&province='+province,
data :'text',
success: function(data){
$("#schoollist").html(data);
//$("#schoollist").html(data);
}
})
}
</script>
<div>
<p>
<%= link_to "全部学校",school_index_path %>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% if User.current.logged? %>
<a href="http://course.trustie.net">我的学校</a>
<% end %>
</p>
<ul>
<li style="width: 40%; float: left">请选择省份:
<select id="province" name="province" onchange="get_school(this.value)"></select>
</li>
<li style="width: 50%; float: left"><input type="text" id="key_word" name="key_word" />
<input type="button" class="enterprise" value="搜索" onclick="ssearch()"></li>
</ul>
</div>
<div style="clear: both"></div>
<div>
<ul id="schoollist" style="line-height: 25px">
</ul>
</div>