我刚开始使用jQuery,但我无法使用它.
在index.php页面上,我想要一个发布到的搜索表单search.php.接下来,我希望将HTML search.php(其中只有一个包含结果的表)插入到"结果" div中index.php.
这是我正在使用的代码:
<script type="text/javascript">
/* attach a submit handler to the form */
$(document).ready(function () {
alert("Ok - 1");
$("#zoeken").submit(function (event) {
alert("Ok - 2");
event.preventDefault();
$.post("https://nodots.nl/labs/dd/search.php", $("#zoeken").serialize() {
alert("Ok - 3");
success: function (html) {
$("#result").empty().html(html);
alert("Ok - 4");
}
});
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
警报用于调试,但不会显示任何警报.谁能告诉我我做错了什么?
当我尝试使用链接boost的库libboost_serialization.so构建一些应用程序时,我有以下错误消息:
/usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../x86_64-suse-linux/bin/ld: cannot find -llibboost_serialization
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
这是ldconfig的输出:
linux-rxa13:/usr/lib64 # ldconfig -p | grep serialization
libboost_wserialization.so.1.46.1 (libc6,x86-64) => /usr/lib64/libboost_wserialization.so.1.46.1
libboost_wserialization.so (libc6,x86-64) => /usr/lib64/libboost_wserialization.so
libboost_serialization.so.1.46.1 (libc6,x86-64) => /usr/lib64/libboost_serialization.so.1.46.1
libboost_serialization.so (libc6,x86-64) => /usr/lib64/libboost_serialization.so
Run Code Online (Sandbox Code Playgroud)
这是构建测试应用程序的命令行:
g++ -o "m" m.o -L/usr/lib64 -llibboost_serialization
Run Code Online (Sandbox Code Playgroud)
我已经搜索了这个问题的解决方案,但我还没找到.谢谢!
首先,我有一个非常简单的java bean,可以很容易地序列化为json:
class Node {
private String text;
// getter and setter
}
Node node = new Node();
node.setText("Hello");
String json = new Gson().toJson(node);
// json is { text: "Hello" }
Run Code Online (Sandbox Code Playgroud)
然后为了使这样的bean有一些动态值,所以我创建了一个"WithData"基类:
Class WithData {
private Map<String, Object> map = new HashMap<String, Object>();
public void setData(String key, Object value) { map.put(key, value); }
public Object getData(String key) = { return map.get(key); }
}
class Node extends WithData {
private String text;
// getter and setter
}
Run Code Online (Sandbox Code Playgroud)
现在我可以为节点设置更多数据:
Node node = …Run Code Online (Sandbox Code Playgroud) 为什么在反序列化时调用Food and Fruit类的构造函数,因为在下面的示例中没有调用SkinFruit和Banana2的构造函数?
假设我有以下类层次结构
class Food{
public Food() { System.out.println("1"); }
}
class Fruit extends Food {
public Fruit() { System.out.print("2"); }
}
class SkinFruit extends Fruit implements Serializable{
SkinFruit() { System.out.print("3"); }
}
public class Banana2 extends SkinFruit {
private static final long serialVersionUID = 1L;
int size = 42;
public static void main(String [] args) {
Banana2 b = new Banana2();
FileOutputStream fost;
try {
fost = new FileOutputStream(new File("d:/testbanana.ser"));
ObjectOutputStream oostr= new ObjectOutputStream(fost);
oostr.writeObject(b);
oostr.flush();
oostr.close();
} …Run Code Online (Sandbox Code Playgroud) 我正在使用以下函数来尝试将对象序列化为XML ..
public static string SerializeObject<T>(T obj)
{
try
{
string xmlString = null;
MemoryStream memoryStream = new MemoryStream();
XmlSerializer xs = new XmlSerializer(typeof(T));
XmlTextWriter xmlTextWriter = new XmlTextWriter(memoryStream, Encoding.UTF8);
xs.Serialize(xmlTextWriter, obj);
memoryStream = (MemoryStream)xmlTextWriter.BaseStream;
xmlString = UTF8ByteArrayToString(memoryStream.ToArray()); return xmlString;
}
catch (Exception ex)
{
return string.Empty;
}
}
Run Code Online (Sandbox Code Playgroud)
尝试序列化其中包含IList属性的对象时,我得到以下异常..
Cannot serialize member 'ObjectModel.Order.LineItems' of type 'System.Collections.Generic.IList
Run Code Online (Sandbox Code Playgroud)
有人可以帮助我改变我的功能以适应这种情况吗?
有什么我可以做这个现有的代码来查看输入对象.如果它的Ilist类型将其更改为List?如果可能的话,somoeone可以帮我编写代码吗?
有关ActionScript 3中xml反序列化的最佳实践是什么?
我正在开发一款实时的多人Facebook游戏.我更喜欢用Flash编写客户端.此外,服务器端是用Java编写的.服务器和客户端之间的通信带有"socket".服务器和客户端相互发送xml.正如可能预期的那样,Xmls包含"对象",这些对象派生自位于两侧的类.类名称和属性是同步的.
谈到我的问题,我在actionscript端尝试了一些用于序列化和反序列化的库.但是大多数都不能完全发挥作用.
例如;
Asx3mer.instance.fromXML(xmlObj)
此库不会将xml转换为具有Array属性的对象,并且该数组包含另一个数组(我的意思是嵌套数组).
你能帮我解决这个问题吗?
谢谢.
起初,我选择了json进行自动序列化.但是当我反序列化json对象时,它被转换为类型为"Object"的对象.每次我都不得不在json字符串中放置一个标识符来处理它的类型.
我研究过AMF,但正如你所提到的,AMF使用它的消息传递标准,我认为在服务器端处理反序列化对象可能很困难(但现在,我的选择表明客户端反序列化变得难以处理).
xml serialization actionscript actionscript-3 deserialization
[Serializable()]在类声明之前,我总是在我的WebServices中使用它来序列化它.今天在教程中我看到[Serializable]......
有什么区别?
有没有办法序列化一个表单,以便输出将是base64编码?
带着敬意,
麦克风.
是否可以序列化非静态内部类?
如果是,你可以提供一个很好的例子.
我搜索了几个博客和非答案的网站说服了我.
编辑: 内部类具有最终的staic变量怎么样.
试图复制msdn引用在这里不起作用,并给出一个错误,我想增加json序列化的允许长度
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
...
Run Code Online (Sandbox Code Playgroud) serialization ×10
c# ×2
forms ×2
java ×2
jquery ×2
json ×2
.net ×1
actionscript ×1
asp.net ×1
base64 ×1
boost ×1
c++ ×1
g++ ×1
gson ×1
linux ×1
post ×1
web-config ×1
web-services ×1
xml ×1