Prototype. js and jquery. js Ajax calls

Source: Internet
Author: User

Different project module extension teams adopt different frameworks. prototype is converted to jquery at the front end, and Ajax calls are differentiated based on the following records

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"    pageEncoding="ISO-8859-1"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

 

Of course, when using jquery, you can use the following method to register related events for the component. Note the conflict between prototype and jquery on the $ operator.

$(document).ready(function(){$("#callJQueryAjax").click(function(){jQuery.ajax({type:"post",url:"test1.jQuery?para1=value1",dataType:"text",success:function(data){alert("value returned from sever is : " + data );}});});};

The preceding Ajax application resource is a common servlet. The web. xml configuration is as follows. Annotations can also be used in servlet3.0.

<servlet>    <servlet-name>test1</servlet-name>    <servlet-class>com.test.Test1OfPrototype</servlet-class>  </servlet>  <servlet-mapping>    <servlet-name>test1</servlet-name>    <url-pattern>/test1.prototype</url-pattern>  </servlet-mapping>  <servlet>    <servlet-name>test1JQuery</servlet-name>    <servlet-class>com.test.Test1OfJQuery</servlet-class>  </servlet>  <servlet-mapping>    <servlet-name>test1JQuery</servlet-name>    <url-pattern>/test1.jQuery</url-pattern>  </servlet-mapping>

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.