为了实现图像上传到PageDown markdown编辑器,我修改了一些关于编辑器的代码.
Markdown.Editor.js
var defaultsStrings = {imagedialog:"<input id ='image'type ='file'/>"}
选择图片然后单击确定按钮发送ajax请求.它可以返回图像路径.
var okButton = doc.createElement("input");
okButton.type = "button";
okButton.onclick = function () {
var data = new FormData();
data.append('file', $( '#image' )[0].files[0] );
$.ajax({
url: 'uploadFile',
data: data,
processData: false,
contentType: false,
type: 'POST',
success: function ( data ) {
alert(path);
}
});
return close(false);};
Run Code Online (Sandbox Code Playgroud)
如何在编辑器预览区域中预览图像?
我在我的页面中写了一个自定义链接,由views模块创建,我想点击它来做某事,然后页面将由ajax刷新,我该如何实现呢?
对不起,我没有清楚表达自己,我使用Drupal 7和Views模块来自定义我自己的页面.
请求:
我发送一个"get"http请求,没有参数;
路径:http://192.168.22.139:8080/KSP
响应:
<input id="username" type="text" name="username" required/>
<input id="password" type="password" name="password" required/>
<input type="hidden" name="lt" value="LT-697-vbNmm6NKOZ0cd7Wg1ywzbMKLa0DnOc" />
<input type="hidden" name="execution" value="e1s1" />
<input type="hidden" name="_eventId" value="submit" />
Run Code Online (Sandbox Code Playgroud)我添加了两个XPath Extractor来获取lt和execution:
lt; //*[@id="login"]/input[3]execution; //*[@id="login"]/input[4]
然后我发送另一个请求username/password/service/It/execution/_eventId:

错误:我得到的票证和执行是空的,我通过chrome获取xpath,那么问题是什么?