ajax get请求

1.

http://192.168.137.3:9000/api/check_db_connect/?user=11&password=22&port=33&ip=44&db=55

返回success


node2:/django/mysite/static/Js/Monitor#vim testdb.js
node2:/django/mysite/static/Js/Monitor#cat testdb.js 
$(function(){
	var _env_bt = $(".content .con #condition .es_2");
	_env_bt.on('click',function(){
		var __user = $(".equipment_sz1").val();
		var __password = $(".equipment_sz2").val();
		var __port = $(".equipment_sz3").val();
		var __ip = $(".equipment_sz4").val();
		var __db = $(".equipment_sz5").val();
                console.log(__user);
                console.log(__password);
                console.log(__port);
                console.log(__ip);
                console.log(__db);
		var data={};
                data.user = __user;
		data.password = __password;
		data.port=__port;
		data.ip=__ip;
		data.db=__db;
		var successfn = function(jdata){
                    // $(".gridtable").empty();
					// var _HTML="<tr><th>IP </th><th>Info</th><th>ENV</th></tr>";
					// $.each(jdata,function(i,val){
						// _HTML=_HTML+"<tr><td>"+jdata[i].ip+"</td><td>"+jdata[i].info+"</td><td>"+jdata[i].env+"</td></tr>";
					// });
					// $(".gridtable").html(_HTML);
                };
		var errorfn = function(){
                    alert("数据获取出错");
                };
	$.ajax({
				type: "get",
				data: data,
				url: "/api/check_db_connect",
				dataType: "text",
				success: function(d){
					successfn(d);
				},
				error: function(e){
					errorfn(e);
				}
			});
	});
	
});



调头接口:

def check_db_connect(req):
   print req.get_full_path()
   return HttpResponse('success')