js代码
function show(fileId){
$.ajax({
url:'http://localhost:80/show',
dataType:'jsonp',
data:{
'fileId':fileId
},
cache:false,
jsonp:'callback',
timeout:5000,
success: function (data) {
var data = $.parseJSON(data);
alert(data.message);
},
error: function(jqXHR, textStatus, errorThrown) {
alert('error ' + textStatus + " " + errorThrown);
}
});
}
var express = require('express');
var logger = require('../common/logger');
var url = require('url');
exports.show = function (req, res, next) {
var queryObj = url.parse(req.url,true).query;
res.send(queryObj.callback+'(\'{"message": "展示ID为' +queryObj.fileId+
'的信息"}\')');
}