我在提交表单时尝试输入textarea标签:
<textarea id="confirmationText" class="text" cols="86" rows ="20" name="confirmationText" form="confirmationForm"></textarea>
<form action="sendConfirmation.php" name="confirmationForm" method="post">
<input type="submit" value="Email" class="submitButton">
</form>
Run Code Online (Sandbox Code Playgroud)
如您所见,我在textarea标记中设置了form ="confirmationForm"属性.我使用Live HTTP Headers来捕获POST请求并且它是空的(所以我知道问题不在sendConfirmation.php中,问题是confirmationText没有被POST).我搜索过网,据我所知,我已经正确设置了它.
我一直react-native在另一台电脑上处理项目,它工作正常。现在,我将项目克隆到我react-native安装的另一台设备上,因为我正在处理其他项目,但无法运行它。
当我运行时,react-native run-android我收到此错误:
无法运行程序“npx”:错误=2,没有这样的文件或目录
我正在尝试创建一个javascript对象,以便我可以稍后将其发布到我的后端,但我遇到了一些麻烦.
这是我正在尝试的代码.当我将console.log创建到对象时,一切都很好,但是当我发布它时,$.post我遇到了一些错误.我认为错误正在发生,因为在对象中我有一个方法,可能会导致问题,但我需要该方法动态生成对象.
var appointmentsPart = {
"id":"appointments",
"integrationId":"1258514282"
}
var appointments = new objectPart('appointments', '1258514282');
appointments.addPart(appointmentsPart);
console.log(appointments); //this shows the correct object
function objectPart(id, integrationId){
this.id = id;
this.integrationId = integrationId;
this.part = new Array();
this.addPart = function(obj){
this.part.push(obj);
}
}
Run Code Online (Sandbox Code Playgroud)
当我使console.log()everythings是我想要的节目,但问题是当我想使用$ .post()将此对象发布到php文件
$.post('/api.php', {api: appointments}, function(){
console.log('test')
});
Run Code Online (Sandbox Code Playgroud)
我明白了 Cannot read property 'push' of undefined
我创建了一个jsfiddle来帮助您理解我的问题.