我正在为我的应用程序使用Sinch SDK。这是使用sinch创建用户的JavaScript代码:
var signUpObj = {};
signUpObj.username = $('input#username').val();
signUpObj.password = $('input#username').val();
sinchClient.newUser(signUpObj);
此代码运行正常。我想要的是一旦创建了新用户,那么这段代码将执行:
$("#myForm").submit();
我如何使用JavaScript实现这一目标?任何帮助,将不胜感激。感谢
答案 0 :(得分:0)
尝试以下方法:
sinchClient.newUser(signUpObj)
.then(function() {
//Things to do on success
$("#myForm").submit();
})
.fail(function(error) {
//Manage error (One/more identities may be taken, or password not strong enough, or other)
})
文档:http://download.sinch.com/docs/javascript/latest/reference/classes/SinchClient.html
答案 1 :(得分:0)
感谢Aswin Ramesh。你的解决方案有效!
解决方案:
sinchClient.newUser(signUpObj, function() {$("#myForm").submit(); });