7种ajax请求

前端之家收集整理的这篇文章主要介绍了7种ajax请求前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

ajax请求:7种(xxx.js.erb 文件不一定需要)
1.a标签:

<a href="/controller_name/action_name" data-remote=true></a>

例子:
源码a

<a href="/instructor_monitoring/get_student_basic_information?id=<%=@student.id%>&teacher_num=<%=@teacher.teacher_num%>" class="hover dianji" data-remote=true onclick="dianji(this)">行政班级信息</a>
  <a href="/instructor_monitoring/get_student_curricula_and_performance?sno=<%=@student.sno%>" class="dianji" data-remote=true onclick="dianji(this)">选课与成绩</a>
  <a href="/instructor_monitoring/get_student_school_track?sno=<%=@student.sno%>" class="dianji" data-remote=true onclick="dianji(this)">校内轨迹</a>
  <a href="/instructor_monitoring/get_student_net_usage?sno=<%=@student.sno%>" class="dianji"  data-remote=true onclick="dianji(this)">网络使用</a>

2、form表单:

<form action="/controller_name/action_name" method="" data-remote=true></form>

例子:
源码b

<form action="/instructor_monitoring/selected_history_warning?teacher_num=<%=@teacher.teacher_num%>"
原文链接:/ajax/162298.html

猜你在找的Ajax相关文章