我想要做的是将TextArea内容转换为有效的HTML代码.假设您在TextArea中键入内容,然后按下一个按钮,该按钮显示元素内的键入文本.如果您在TextArea中输入类似内容:
嗨伙计!
你喜欢jQuery吗?
我做!
你必须放在''元素中的结果字符串是:
Hi folks!<br>Do you like jQuery?<br>I do!
Run Code Online (Sandbox Code Playgroud)
那是因为TextArea中的换行必须转换为<br>标签!
如果您想获取元素的html并将其放在TextArea输入字段中,则应该发生同样的事情,例如:
Hi folks!<br>Do you like jQuery?<br>I do!
Run Code Online (Sandbox Code Playgroud)
应转换为:
嗨伙计!
你喜欢jQuery吗?
我做!
那么,有没有办法将字符串转换为html-string(反之亦然)或者我应该自己编写一个函数?
提前致谢!
有没有办法使用JAVA将第三方jar添加到Azure功能.我需要让json-simple jar和jackson-databind jar在运行时可用于该函数.现在,我的代码抛出一个运行时异常(ClassNotFound Exception),因为该函数在运行时无法引用jar,因为它不可用.
我尝试使用maven-shade-plugin.它确实创建了一个包含外部jar的可执行jar,但部署仍然采用原始jar.
请建议.
谢谢.
的pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sce.api.learning</groupId>
<artifactId>myApi</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Azure Java Functions</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<functionAppName>mckapi-http-nov2</functionAppName>
</properties>
<dependencies>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-functions-java-core</artifactId>
<version>1.0.0-beta-1</version>
</dependency>
<!-- Adding GSON dependancy -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.3</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20171018</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<groupId>com.microsoft.azure</groupId> …Run Code Online (Sandbox Code Playgroud) 我是关于jQuery工作流程的新手,我想设置一个使用内部方法发出AJAX请求的javascript类.当请求成功返回时,jQuery AJAX回调应该调用类本身拥有的方法.那是代码:
function IXClock()
{
this.m_intervalID = 0;
this.startClock = function ()
{
this.m_intervalID = setInterval(this.tictac, 500);
}
this.stopClock = function ()
{
clearInterval(this.m_intervalID);
}
this.setClockTime = function(p_strTime)
{
$('#clock').html(p_strTime);
}
this.tictac = function ()
{
$.ajax
({
type: 'POST',
url: '/rap/rapClock.php',
complete: function (data)
{
this.setClockTime(data);
}
});
}
}
Run Code Online (Sandbox Code Playgroud)
该类表示一个时钟,内部方法(tictac)请求服务器端的"时间".在服务器说出时间之后,jQuery的AJAX方法应该调用IXClock类的setClockTime方法.invoke方法将更新html页面中的#clock div项.
问题是方法this.setClockTime()结果未知,javascript返回"this.setClockTime不是函数"错误.
问题是:有没有办法从jQuery的AJAX回调中调用类方法?