我在创建表单中有以下标记: -
<form method="post" action="./NewForm.aspx?Source=http%3a%2f%2fwww.******.intra%2fOrderManagement%2fLists%2fOrderManagement%2fAllItems.aspx&
ContentTypeId=0x0103006FFC142316C0B148896E3C32099B654E0100C4125A72ABD48B46AEB7AB17A2E53735&RootFolder=%2fOrderManagement%2fLists%2fOrderManagement" onsubmit="javascript:return WebForm_OnSubmit();" id="aspnetForm" enctype="multipart/form-data">
现在我不确定如何获取ContentTypeId
属性中action
参数的值,以获取ID = aspnetForm
的表单?
答案 0 :(得分:0)
长话短说:
console.log(
unescape($('#aspnetForm').attr('action'))
.split('?').pop().split('&')
.reduce(function(o, e){
p = e.split('=');
o[p[0]] = p[1];
return o;
}, {})
.ContentTypeId
)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form method="post" action="./NewForm.aspx?Source=http%3a%2f%2fwww.******.intra%2fOrderManagement%2fLists%2fOrderManagement%2fAllItems.aspx&ContentTypeId=0x0103006FFC142316C0B148896E3C32099B654E0100C4125A72ABD48B46AEB7AB17A2E53735&RootFolder=%2fOrderManagement%2fLists%2fOrderManagement" onsubmit="javascript:return WebForm_OnSubmit();" id="aspnetForm" enctype="multipart/form-data">