ajax 获取表单内容然后传递PHP

我之前一直在用DOM通过js提取表单内容给PHP做处理,其实也就相当于没用form。。

后来form的内容越来越多了,通过一个个getElementById来获取表单内容然后给PHP越来越不现实了

我在想能不能通过form原本的POST方式(或者有别的方式?)直接将表单内容变成数组,然后js获取数组之后在传递给后台PHP,然后PHP在解析数组做处理,这样做ajax?

可能以上描述不是很专业,忘大神谅解,非常感谢

6个回答

Sample

....

Jquery

$.ajax({
type: "POST",
url: 'url.php',
data: $('#frmSubmit').serialize(),
success: function (data) {
// your codes
}
});

PHP
与原有form POST 处理没区别。

看这里http://www.w3school.com.cn/jquery/ajax_serialize.asp 要使用jQuery前端框架哦

设置表单的target为隐藏iframe的name值,将表单提交到隐藏iframe来模拟ajax无刷新操作,或者倒入jquery框架,调用serialize方法即可将表单序列化为键值对字符串。

或者自己遍历表单也行



        function serializeForm(f) {//参数f为表单这个DOM对象
            var params = '', tmp;
            for (var i = 0; i < f.elements.length; i++) {
                if (f.elements[i].name) {
                    switch (f.elements[i].type) {
                        case 'hidden':
                        case 'password':
                        case 'text':
                        case 'textarea':
                        case 'select-one':
                            params += (params == '' ? '' : '&') + f.elements[i].name + '=' + encodeURIComponent(f.elements[i].value); break;
                        case 'select-multiple':
                            tmp = '';
                            for (var p = 0; p < f.elements[i].options.length; p++)
                                if (f.elements[i].options[p].selected) tmp += (tmp == '' ? '' : ',') + f.elements[i].options[p].value;
                            if (tmp != '') params += (params == '' ? '' : '&') + f.elements[i].name + '=' + encodeURIComponent(tmp); break;
                        case 'radio': case 'checkbox':
                            if (f.elements[i].checked) params += (params == '' ? '' : '&') + f.elements[i].name + '=' + encodeURIComponent(f.elements[i].value); break;
                    }
                }
            }
            return params;
        }

会JQUERY就不存在getElementById的困扰了

jQuery里有个serializeArray()方法,可以将表单数据整合成JSON,非常方便;或者使用serialize()方法整合成键值对字符串,也不错。

如此,使用PHP处理起来非常舒服~~~

请采纳!

使用jq。
getElementById("myId")--》$("#myId")
如果是input,使用val()获取其值,设置值用val("设值")
用法:
$("#myId").val();
教程:
http://www.w3school.com.cn/jquery/jquery_dom_get.asp

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
使用Ajax从表单传递数据

<div class="post-text" itemprop="text"> <p>Wondering if someone could help me. I have next to no knowledge with Ajax, and after many attempts at trying to pass my User1_id and Text through to my insert.php I've had no luck with inserting the data I want to my database.</p> <p>As my profile.php and insert.php stands, the form submits to the database, but when the user submits the form it navigates to the insert.php and would rather have the Ajax send the data and stay on the Profile.php at all times, I feel this is a much better approach when creating such functions.</p> <p>I'm wondering if someone can guide me in the right direction on how I'd go about doing this.</p> <p>Profile.php Form</p> <pre><code>&lt;form id="FormId" action="" method="get"&gt; &lt;input type="hidden" value="&lt;? echo $user1_id ?&gt;"&gt; &lt;textarea placeholder="Whats New??" id="FormId" name="status"&gt;&lt;/textarea&gt; &lt;input type="submit" name="Submit" value="Submit"&gt; &lt;/form&gt; </code></pre> <p>Insert.php</p> <pre><code> &lt;? session_start(); ini_set('display_errors',1); error_reporting(E_ALL|E_STRICT); include "db_connect.php"; if (isset($_GET['status'])) { $status = $_GET['status']; } $user1_id=$_SESSION['id']; if ($_GET['status']) { $query = mysql_query("INSERT INTO feed (status,user1_id) VALUES ('$status', '$user1_id')") or die (mysql_error()); if($query){ echo "Posted Into Database"; } exit(); } ?&gt; </code></pre> <p>I know I need something similiar to this.. But I think I'm stuck more on the var/data part.</p> <pre><code>$("form#myFormId").submit(function() { var mydata = $("form#myFormId").serialize(); alert(mydata); // it's only for test $.ajax({ type: "GET", url: "insert.php", data: mydata, success: function(response, textStatus, xhr) { alert("success"); }, error: function(xhr, textStatus, errorThrown) { alert("error"); } }); return false; }); </code></pre> <p>But don't know how to go about it.</p> <p>Any guidence is appreciated. Not asking anyone to write the code out for me. But good direction is welcomed. </p> <p>Thanks.</p> </div>

Ajax提交表单与一般提交表单的差别?

在一般提交表单时,浏览器html将表单数据submit到服务器后,服务器会执行相关的处理脚本 比如(php,asp)等,进行处理,再将相关的HTML返回到浏览器端。 而ajax改变了这一过程,它是浏览器html将表单数据提交给本地的javascript,而javascript调用XMLHTTPRequest, 利用XMLHTTPRequest将数据传给服务器端,服务器端通过javascript收到数据,再调用处理脚本(php, asp)进行处理,再将处理后的HTML通过javascript返回到浏览器。 感觉在这里ajax与一般的提交表单的差别就是不用submit,而是采用了javascript, 而javascript中调用了具有传递与接收数据功能的XMLHTTPRequest等。 是不是这样的啊?

表单只提交一个值,使用AJAX将表单数据传递到同一页面中的PHP

<div class="post-text" itemprop="text"> <p>I need to pass a single value from my form to my php in the same page. It´s probably not an option to create another .php file and take the code there since there´s a lot going on. This is the part of the code I need to fix, currently it only works when the code is on another file, since the $_POST is not messing around with other parts of the code. Specifically I need to manage to pass the 'client' or the 'empre' from the form alone to the php.</p> <p>HTML</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/ libs/jquery/1.3.0/jquery.min.js"&gt; &lt;/script&gt; &lt;script type="text/javascript" &gt; $(function() { if($(".cliente").click(function() { var name = $("#client").val(); var dataString = 'client='+ name; }))else if($(".empresa").click(function() { var name = $("#empre").val(); var dataString = 'empre='+ name; })); $.ajax({ type: "POST", data: dataString}); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form&gt; &lt;input name="client" type="text"&gt;&lt;br&gt; &lt;input class="cliente" type="submit" value="Buscar cliente"/&gt;&lt;br&gt; &lt;input name="empre" type="text"&gt;&lt;br&gt; &lt;input class="empresa" type="submit" value="Buscar empresa"/&gt;&lt;br&gt; &lt;/form&gt; //PHP HERE //HTML AGAIN &lt;/body&gt; &lt;/html&gt; </code></pre> <p>PHP (same page, just separating for readability)</p> <pre><code> if(isset($_POST['empre'])){ //DB QUERY } elseif(isset($_POST['client'])){ //DB QUERY } </code></pre> </div>

将表单数据从jQuery.ajax()传递到SilverStripe php文件以进行验证和电子邮件提交

<div class="post-text" itemprop="text"> <p>I have built out a fairly simple html form that, once submitted, will email the contents to an email address.</p> <p>I am have setup jQuery to take the form data and send it to a php code file thrugh an ajax request:</p> <pre><code>(function($) { $(document).ready(function() { var SubmitBtn = $('#Schedule-Button'); var SchFirstName = $('#FName'); var SchLastName = $('#LName'); var SchAddress = $('#Address'); var SchCity = $('#City'); var SchZip = $('#Zip'); var SchEmail = $('#Email'); var SchPhone = $('#Phone'); var SchService = $('#ServiceReq'); var SchLocation = $('#Location'); var SchDoctor = $('#PhysicianName'); var SchOther = $('#OtherService'); var SchTime = $('#BestTime'); var SchInterpret = $('#InterpreterNeeded'); var SchedulePopup = $('[data-remodal-id=sch-modal]').remodal(); SubmitBtn.on('click', function(e) { var required = [SchFirstName, SchLastName, SchAddress, SchCity, SchZip, SchEmail, SchPhone, SchService]; var containsError = false; e.preventDefault(); for (i = 0; i &lt; required.length; i++) { var input = required[i]; if ((input.val() == "")) { containsError = true; input.addClass('error-field'); $('.Sch-Error-Msg').show(); } else { input.removeClass('error-field'); $('.Sch-Error-Msg').hide(); } } if (containsError == false) { ajax_script(); $('#appt-form')[0].reset(); SchedulePopup.close(); } }); function ajax_script() { var form_data = { firstname: SchFirstName.val(), lastname: SchLastName.val(), useraddress: SchAddress.val(), city: SchCity.val(), zipcode: SchZip.val(), email: SchEmail.val(), phone: SchPhone.val(), servicereq: SchService.val(), location: SchLocation.val(), doctor: SchDoctor.val(), other: SchOther.val(), calltime: SchTime.val(), interpreter: SchInterpret.prop('checked') }; $.ajax({ type: "POST", url: "/home/ScheduleAppointment", data: form_data, success: function() { alert("Form submitted! Thank you.") } }); } }); }(jQuery)); </code></pre> <p>I am lost as to what to do in the SilverStripe code file, though, to process the data (I don't have much experience setting up forms like this using ajax, and I normally use a form plugin in SilverStripe). Any help or even some hints would be great so I can figure out what step to take next.</p> <p>I have the function "shell" ready to go in HomePage.php (under mysite/code):</p> <pre><code>public function ScheduleAppointment() { //here is where I process the form data from the form_data variable return "test"; } </code></pre> </div>

通过JQuery $ .ajax将多个JavaScript对象传递给PHP

<div class="post-text" itemprop="text"> <p>I have a object <strong>recipe</strong> that has multiple params</p> <p>This works, I passed the object thru ajax to my php</p> <pre><code> $.post('addRecipe.php', recipe, function () {}); </code></pre> <p>And this works, php getting the params</p> <pre><code>function getParam($param) { if (!empty($_POST[$param])) { return $_POST[$param]; } return 'UNKNOWN'; } $name = getParam('name'); $phone = getParam('phone'); </code></pre> <p>Now I want to pass 2 objects the <strong>recipe</strong> that has multiple params and <strong>recipeID</strong> that has 1 param</p> <pre><code> $.post('editRecipe.php', {recipe: recipe, recipeID: recipeID}, function (){}); </code></pre> <p><strong>how can i get it with php?</strong></p> </div>

如何将输入文本框值的参数传递给jQuery中的ajax

<div class="post-text" itemprop="text"> <p>My Ajax code </p> <pre><code>$(document).ready(function() { $("#sub").click(function() { $.ajax({ type: "POST", url: "jqueryphp.php", data: "txt1=" + txt1, success: function(result) { $("div").html(result); } }); }); });​ </code></pre> <p>This is the form code . I want to pass txt1 value to Ajax</p> <pre><code>&lt;input type="text" name="txt1" id="txt1" /&gt;&lt;br&gt; &lt;input type="button" name="sub" id="sub" value="click Me" /&gt; </code></pre> <p>I want to pass <strong>txt1</strong> value to my php page using this Ajax function. </p> <p>Please tell me what exactly will come in the data attribute of Ajax</p> </div>

AJAX传递表单数据

<div class="post-text" itemprop="text"> <p>I am trying to figure out why this is not working. Here is the sub-set of my form that looks like this:</p> <pre><code> &lt;input type="hidden" id="gift_id3" name="giver3gift_id" value="925"&gt;&lt;/td&gt; &lt;tr id="tr3"&gt; &lt;td&gt; &lt;select class="type" id="type3" name="giver3paymenttype_val"&gt; &lt;option value="1" SELECTED&gt;Check&lt;/option&gt; &lt;option value="2"&gt;Cash&lt;/option&gt; &lt;option value="3"&gt;ACH&lt;/option&gt; &lt;option value="4"&gt;In Kind Donation&lt;/option&gt; &lt;/select&gt; &lt;/td&gt; &lt;td&gt;&lt;input type="text" class="refnum" id="refnum3" name="giver3ref_num" value="2147483647"&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" class="amount" id="amount3" name="giver3amount" value="25.00" onBlur="this.value=formatCurrency(this.value)"&gt;&lt;/td&gt; &lt;td&gt; &lt;select class="type" id="type3" name="giver3taracct_val"&gt; &lt;option value="1" SELECTED&gt;General Fund&lt;/option&gt; &lt;option value="2"&gt;Building Fund&lt;/option&gt; &lt;option value="3"&gt;Missions Fund&lt;/option&gt; &lt;/select&gt; &lt;/td&gt; &lt;td&gt;&lt;input type="checkbox" id="void3" name="giver3void"&gt; &lt;/tr&gt; </code></pre> <p>Here is my AJAX:</p> <pre><code>var $inputs = $("#dialog-editgiving :input"); var parameters = []; $inputs.each(function() { parameters[this.name] = $(this).val(); }); $.ajax({ url : "./scripts/form_process/update_giving.php", type: "POST", data : {parameters:parameters}, success: function(data, textStatus, jqXHR) { alert(data); }, error: function(jqXHR, textStatus, errorThrown) { alert(errorThrown); } }); </code></pre> <p>Here is my update_giving.php file</p> <pre><code>&lt;?php foreach ($_POST as $key =&gt; $value) { echo "Field ".htmlspecialchars($key)." is ".htmlspecialchars($value)."&lt;br&gt;"; } ?&gt; </code></pre> <p>When I look through the $inputs array, I get the the values that are submitted in the form. Then it is handed off to the "./scripts/form_process/update_giving.php" script, I get nothing in the POST object.</p> <p>Do I have something incorrect in my AJAX request?</p> </div>

通过AJAX从UI Dialog传递表单信息

<div class="post-text" itemprop="text"> <p>I have the following code:</p> <p>HTML</p> <pre class="lang-or-tag-here prettyprint-override"><code>&lt;div id="resume-begin" style="background:#CCCCCC; display:inline-block;"&gt; &lt;img src="/images/plus-plus.png" style="display:inline;" class="trigger"/&gt; &lt;/div&gt; &lt;div class="input-resume-data" style="display:none;"&gt; &lt;form id="project-form"&gt; &lt;label for="resume-create-name"&gt;Resume Project Name:&lt;/label&gt; &lt;input type="text" id="resume-create-it" name="resume-create-it" class="text ui-widget-content ui-corner-all"&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p>jQuery</p> <pre class="lang-or-tag-here prettyprint-override"><code>&lt;script&gt; $(document).ready(function() { $('#resume-begin').click(function() { ('#resume-begin').hide(); $('.input-resume-data').dialog("open"); }); }); &lt;/script&gt; </code></pre> <p>Once the div resume-begin is clicked, it opens my UI Dialog box, which is as follows:</p> <pre class="lang-or-tag-here prettyprint-override"><code>&lt;script&gt; $(function() { $( ".input-resume-data" ).dialog({ title: 'Name your Resume Project', autoOpen: false, resizable: false, height: 450, width: 380, show: { effect: 'drop', direction: "up" }, modal: true, draggable: true, buttons: { "Submit": function() { var $this = $(this); var string = $('#resume-create-it').serialize(); $.ajax({ url: 'functions.php', type: 'POST', data: string, success: function(data){ alert("Project created!"); $this.dialog('close'); } }); }, Cancel: function() { $( this ).dialog( "close" ); $( "#resume-begin" ).show( "slow", function() { }); //end function } //end cancel button } //end buttons }); //end dialog }); //end jquery function &lt;/script&gt; </code></pre> <p>What I would like:</p> <p>Once the user enters the text in the UI-input, and clicks Submit, I want to post the data to the PHP page, where I would save it to the database. Currently, if I enter in data and push submit, the success function works, but the data is not saved in the database. </p> <p>In my PHP, I try to grab the data like:</p> <pre class="lang-or-tag-here prettyprint-override"><code>//Sanitize the POST values $resumeProjectname = $_POST['resume-create-it']; </code></pre> <p>I am unsure if I am passing the data correctly, which is through the variable "string" in jQuery, as well as if I'm retrieving the data correctly in the php file.</p> <p>Any help would be greatly appreciated. Please let me know if you have any questions!</p> <p>Thanks.</p> </div>

通过ajax post将文件与表单数据一起发送

<div class="post-text" itemprop="text"> <p>I'm trying to upload a file via ajax together with some fields in a form. However, it doesn't work. I get this error.</p> <blockquote> <p>Undefined Index :- File</p> </blockquote> <p>Here's my code.</p> <p><strong>HTML</strong></p> <pre><code> &lt;!-- File Button --&gt; &lt;div class="form-group"&gt; &lt;label class="col-md-4 control-label" for="file"&gt;Upload Software / File&lt;/label&gt; &lt;div class="col-md-4"&gt; &lt;input id="file" name="file" class="input-file" type="file"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;label class="col-md-4 control-label" for="price"&gt;Price($)&lt;/label&gt; &lt;div class="col-md-4"&gt; &lt;input id="price" name="price" type="text" placeholder="Price" class="form-control input-md" required=""&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>Ajax</strong></p> <pre><code>$("#add_product").click(function(e){ e.preventDefault(); product_name = $("product_name").val(); //d = $("#add_new_product").serialize(); $.ajax({ type: 'POST', url: 'ajax.php', data: $("#add_new_product").serialize(), success: function(response) { // alert(response); } }) }); </code></pre> <p><strong>PHP</strong></p> <pre><code>if (0 &lt; $_FILES['file']['error']) { echo ":!"; } else { echo "ASa"; } </code></pre> <p>What am I missing here?</p> </div>

Ajax表单数据传递

<div class="post-text" itemprop="text"> <p>How can I pass the form data on my PHP file? I have tried the below solution but it was not worked for me. I need to pass all checkboxes on my PHP function.I have tried but not getting the perfect value that I need? </p> <p>Please check the issue and guide me where I was wrong.</p> <pre><code>&lt;form id="filterForm" method="post"&gt; &lt;div class="dropdown"&gt; &lt;button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"&gt; Beer Brands &lt;/button&gt; &lt;div class="dropdown-menu" aria-labelledby="dropdownMenuButton"&gt; &lt;ul&gt; &lt;li&gt;&lt;input class="clickBox" type="checkbox" name="beer_brands[]" value="valu1" /&gt;Test&lt;/li&gt; &lt;li&gt;&lt;input class="clickBox" type="checkbox" name="beer_brands[]" value="valu2"/&gt;Test&lt;/li&gt; &lt;li&gt;&lt;input class="clickBox" type="checkbox" name="beer_brands[]" value="value3"/&gt;Test&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="dropdown"&gt; &lt;button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"&gt; Locations &lt;/button&gt; &lt;div class="dropdown-menu" aria-labelledby="dropdownMenuButton"&gt; &lt;ul&gt; &lt;li&gt;&lt;input class="clickBox" type="checkbox" name="locations[]" value="value4" /&gt;Test&lt;/li&gt; &lt;li&gt;&lt;input class="clickBox" type="checkbox" name="locations[]" value="value5"/&gt;Test&lt;/li&gt; &lt;li&gt;&lt;input class="clickBox" type="checkbox" name="locations[]" value="value6"/&gt;Test&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="dropdown"&gt; &lt;button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"&gt; Sort By &lt;/button&gt; &lt;div class="dropdown-menu" aria-labelledby="dropdownMenuButton"&gt; &lt;ul&gt; &lt;li&gt;&lt;input class="clickBox" type="checkbox" name="sort_by[]" value="value7" /&gt;Test&lt;/li&gt; &lt;li&gt;&lt;input class="clickBox" type="checkbox" name="sort_by[]" value="value8"/&gt;Test&lt;/li&gt; &lt;li&gt;&lt;input class="clickBox" type="checkbox" name="sort_by[]" value="value9"/&gt;Test&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p>JQuery</p> <pre><code>&lt;script type="text/javascript"&gt; jQuery(document).ready(function(){ jQuery(".clickBox").click(function(e){ var b_b_Array = [] var location_Array = [] var sort_by_Array = [] jQuery('.clickBox').each(function () { //debugger; jQuery("input[name='beer_brands[]']").each( function () { if(jQuery('input[name="beer_brands[]"]').is(':checked')) { b_b_Array.push(jQuery(this).val()); } }); jQuery("input[name='locations[]']").each( function () { if(jQuery('input[name="locations[]"]').is(':checked')) { location_Array.push(jQuery(this).val()); } }); jQuery("input[name='sort_by[]']").each( function () { if(jQuery('input[name="sort_by[]"]').is(':checked')) { sort_by_Array.push(jQuery(this).val()); } }); }); console.log(b_b_Array); console.log(location_Array); console.log(sort_by_Array); var ajaxurl = "&lt;?php bloginfo('url');?&gt;/wp-admin/admin-ajax.php"; jQuery.ajax({ url: ajaxurl, type : 'post', data: { 'action':'all_give_aways_filter', 'data' : jQuery("filterForm").serialize(), }, success : function( response ) { console.log(response); // jQuery("div#errMsg").css({'background-color':'white','color':'red'}); // jQuery("div#errMsg").html(response); } }); }); }); &lt;/script&gt; </code></pre> <p>Please Help me to solve this issue.</p> </div>

通过ajax将表单变量从load <div>传递到同一个<div>中?

<div class="post-text" itemprop="text"> <p>I'm trying to pass the variables from the form which was loaded from jquery clicked. Into the same div. I tried test it but none of them works. Here's my script :</p> <p><strong>Javascript</strong></p> <pre><code>//login function login(){ $('#prop_form').load('inc/prop_form_login.php'); $('.axn_btn').hide(); } $(document).ready(function(){ $("form").on('click', '#submit', function(e){ e.preventDefault(); var jsURL = $(this).serialize()+"&amp;lang=$_GET[lang]"; submit(jsURL); }); }); function submit(jsURL){ $.ajax({ url:'login_chk.php', type :'POST', success: function(data){ $('#prop_form').html(data); } }); } </code></pre> <p><strong>HTML</strong></p> <pre><code>&lt;div id="prop_form"&gt; &lt;div class="axn_btn"&gt; &lt;a onClick="login()"&gt;login&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>login_chk.php</strong></p> <pre><code>&lt;? session_start(); error_reporting(E_ALL); print_r($_POST[data]);exit();//for testing purpose . . . ?&gt; </code></pre> <p>I expect the login form data to display in the <code>#prop_form</code>. But the page refresh with return data from <code>login_chk.php</code>. </p> </div>

Jquery Ajax使用表单数据传递JSON数组格式

<div class="post-text" itemprop="text"> <p>I have an API integartion where the SMS service wants us to send data in this format with content-type as json.</p> <pre><code>{ "from": "91887654681", "to": ["918757077777"], "body": "Hi this is my message using Mblox SMS REST API" } </code></pre> <p>I have a form with input texts namely from, to and body.</p> <p>This is how my form submits.</p> <pre><code>$("#sendSMSForm").submit(function(event){ event.preventDefault(); // Serialize the form data. var form = $('#sendSMSForm'); var formData = $(form).serialize(); //alert(formData); $.ajax({ type: 'POST', dataType: 'json', contentType: "application/json", url: $(form).attr('action'), data: formData }).done(function(response) { // Do some UI action stuff alert(response); }); }); </code></pre> <p>I am not sure ...what should be used to pass a similar format.... of which the "to" is an array. </p> </div>

如何通过Ajax和PHP传递表单

<div class="post-text" itemprop="text"> <p>I'm new to this, I just want it to work with simple code then i'll add onto it. But it's not working in the sense that i don't get an echo. I just want to submit a form and have it not refresh the page. </p> <p>here is my form</p> <pre><code>&lt;form &gt; &lt;input type="text" id="name" &gt; &lt;input type="submit" value="s" onclick="return chl()" &gt; &lt;/form&gt; </code></pre> <p><strong>here is my js</strong></p> <pre><code>&lt;script&gt; function chl(){ var name= document.getElementByID('name').value; var dataString='name' + name; $.ajax({ type:"post", url:"hi.php", data:dataString, cache:false, success: function(html){ alert ("success"); } }); return false; } &lt;/script&gt; </code></pre> <p>and here is my php </p> <pre><code>&lt;?php $name=$_POST ['name']; echo "response".$name; ?&gt; </code></pre> </div>

使用AJAX和重定向将表单值传递给PHP变量

<div class="post-text" itemprop="text"> <p>Is it possible for a user to enter a value into a form and then, on submit, have the page redirect to a new one with the value entered into the form stored in a PHP variable?</p> <p>This if my form code;</p> <pre><code>&lt;form id="loc-search" method="post"&gt; &lt;input type="text" id="search-by-location" name="custom-location" value="" placeholder="Sheffield, UK"/&gt; &lt;input type="submit" id="submit" value=""/&gt; &lt;/form&gt; </code></pre> <p>Once the user has entered a value in <code>#search-by-location</code> the page needs to redirect to <code>weather.php</code> with the value stored in a PHP variable called <code>$location</code></p> <p>AJAX / JS aren't my strong suits so if someone could point me in the right direction that would be great</p> </div>

通过ajax为每个ID提交表单

<div class="post-text" itemprop="text"> <p>please guys, have some posts which i outputted from my database and now i want to make a comment form for each post and the form will be submitted through ajax method, but my problem is </p> <ol> <li>the ajax method works for only the first outputted post and the form inserts into the database the <code>mysqli_num_rows($query)</code>. ie if <code>mysqli_num_rows($query)</code> is =5, the form inserts into 5 rows in the database.</li> <li>the remaining outputted forms reloads the page when the submit button is clicked.</li> </ol> <p>This is what I want to achieve:</p> <ol> <li>I want each form to be submitted without reloading.</li> <li><p>I want the form to be inserted in only one row for each. Here is my code:</p> <pre><code>&lt;?php $con = mysqli_connect('localhost', 'root', '') or die ('error'); mysqli_select_db($con, 'test') or die ('error'); $query = mysqli_query($con, "SELECT * FROM testing"); while($sql = mysqli_fetch_array($query)){ $id = $sql['id']; $post = $sql['post']; echo "&lt;p&gt;".$id.". ".$post."&lt;br&gt;"; $pop_id = $id."pop"; ?&gt; &lt;style&gt; .plop { display:none; height:200px; border-bottom:1px solid #000; } &lt;/style&gt; &lt;a href="javascript:;" style="float:right ;margin:20px 20px;" onclick="document.getElementById('&lt;?php echo $pop_id; ?&gt;').style.display='block'"&gt;comment&lt;/a&gt;&lt;/p&gt;&lt;br&gt; &lt;div id="&lt;?php echo $pop_id; ?&gt;" class="plop"&gt; &lt;a href="javascript:;" style="float:right;margin:20px 20px;" onclick="document.getElementById('&lt;?php echo $pop_id; ?&gt;').style.display='none'"&gt;close&lt;/a&gt; &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt; &lt;form id="my-form"&gt; &lt;input type="text" id="comment" name="comment" /&gt; &lt;input type="hidden" id="post" name="post" value="&lt;?php echo $id; ?&gt;" /&gt; &lt;input type="submit" id="submit" value="post" /&gt; &lt;/form&gt;&lt;div id="tutorial"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $('#my-form').submit(function(e) { e.preventDefault(); $.ajax({ method: "GET", url: "dote.php", data: $(this).serialize(), beforeSend: function(){ $('#tutorial').html("&lt;img src='progress-dots.gif' /&gt;"); }, success: function(status) { $('#post').val(''); $('#tutorial').html(""); } }); }); }); &lt;/script&gt; &lt;/div&gt; &lt;?php } ?&gt; </code></pre></li> </ol> </div>

如何通过AJAX将具有相同名称/ ID的多个工作区名称从表单传递到另一个php页面,以便我可以更新我的MySQL表。

<div class="post-text" itemprop="text"> <p>I found solutions for similar questions from stackoverflow as below, but they didn't work for me. <a href="https://stackoverflow.com/questions/25442565/sending-data-via-ajax-with-multiple-inputs-having-the-same-name">Possible Solution 1 here</a></p> <p><a href="https://stackoverflow.com/questions/35696680/how-to-send-multiple-same-name-input-fields-value-via-ajax-post-method">Possible Solution 2 here</a></p> <p>For just one workplace input field, this code works perfectly fine, but by using jQuery functions, I am prepending multiple workplace field dynamically.</p> <p>Also, I don't have any trouble updating data in my MySQL database as far as I am using only one input field for workplace. </p> <p>But when I prepend multiple input fields for workplace, I have trouble passing my different workplace name to php script. </p> <p>So far, I have tried using solutions such as I used class="workplace" instead of id="workplace", but with that I don't even get values of my input field even on the same page when I used "alert(companyname);" to see if I get to see submitted values in alert. But no! </p> <p>Also, I tried making my and other ways such as name="workplace['+index+'][name]", etc. None worked. </p> <p>Database name: workplacedb table name: companyname fields: c_id ,user_id, workplace. </p> <p></p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$(function() { var count = 0; /* WORKPLACE codes start here */ $('.add-workplace').click(function() { var index = $('.workplace-input').length + 1; //$('.add-workplace').hide(); $(".collapse").collapse('show'); $('.workplace-lines').prepend('' + '&lt;div class="input-group workplace-input"&gt;' + '&lt;input type="text" name="workplacename" id="workplace" class="form-control"/&gt;' + '&lt;span class="input-group-btn"&gt;' + '&lt;button class="btn btn-danger btn-remove-workplace" type="button"&gt;&lt;span class="glyphicon glyphicon-remove"&gt;&lt;/span&gt;&lt;/button&gt;' + '&lt;/span&gt;' + '&lt;/div&gt;' ); }); $(document.body).on('click', '.btn-remove-workplace', function() { $(this).closest('.workplace-input').remove(); }); $('.add-workplace').one('click', function() { count = 1; }); $('.add-workplace').click(function() { if (count &gt; 0) { $('.workplace-lines').append('&lt;span class="input-group-btn main-btn"&gt;' + '&lt;button class="btn btn-success btn-workplacesubmit" type="submit" name="submitWeb"&gt;&lt;span class="glyphicon glyphicon-check"&gt;Submit&lt;/span&gt;&lt;/button&gt;' + '&lt;button class="btn btn-danger btn-workplacecancel" type="button" name="cancel" style="margin-left:15px"&gt;&lt;span class="glyphicon glyphicon-remove"&gt;Cancel&lt;/span&gt;&lt;/button&gt;' + '&lt;/span&gt;'); count = 0; } }); // Cancel button click for workplace fields $(document).on('click', '.btn-workplacecancel', function() { $('.workplace-input').remove(); $('.main-btn').remove(); count = 1; }); var workplace_form = $('#workplaceinfo'); workplace_form.submit(function(event) { var companyname = $('#workplace').val(); alert(companyname); if ($.trim(companyname) != '') { $.post('about.php', $("#workplaceinfo").serialize(), function(data) { $('.workplace-lines').hide(); $('.main-btn').hide(); $('#results').html(data); //alert(data); }); } // Prevent default form action event.preventDefault(); }); });</code></pre> <pre class="snippet-code-css lang-css prettyprint-override"><code>&lt;!-- about.php here --&gt; &lt;?php require_once("home_userinfo_retrieve.php"); $mysqli=new mysqli('localhost', 'root', '', 'databasename'); $sql="UPDATE tablename SET workplace=? WHERE user_id='$userid_logged_in'"; $stmt=$ mysqli-&gt;prepare($sql); $stmt-&gt;bind_param("s", $_POST['workplacename']); $stmt-&gt;execute(); $stmt=$mysqli-&gt;prepare("SELECT * FROM detailed_user_info WHERE user_id = ?"); $stmt-&gt;bind_param("s", $userid_logged_in); $stmt-&gt;execute(); $result=$stmt-&gt;get_result(); while($row=$result-&gt;fetch_object()) { $rows[]=$row; } ?&gt; &lt;ul&gt; &lt;?php foreach ($rows as $row):?&gt; &lt;li&gt; &lt;?php echo $row-&gt;workplace; ?&gt;&lt;/li&gt; &lt;?php endforeach; ?&gt; &lt;/ul&gt;</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form action="about.php" method="post" name="workplaceinfo" id="workplaceinfo"&gt; &lt;div class="form-group workplace"&gt; &lt;div class="workplace-lines"&gt; &lt;h5 class="add-workplace"&gt; &lt;a&gt;&lt;span class="glyphicon glyphicon-plus"&gt;&lt;/span&gt; Add your workplace &lt;/a&gt; &lt;/h5&gt; &lt;/div&gt; &lt;h5 id="results"&gt; &lt;/h5&gt; &lt;/div&gt; &lt;/form&gt;</code></pre> </div> </div> </div>

Laravel ajax表单数据未发布到控制器

<div class="post-text" itemprop="text"> <p>I finally got my AJAX function working and it correctly posted data to the controller. But it only worked when the data being sent was included in the form action- /UoE/buy-product/{{product_id}}. But I only want the form action to be /UoE/buy-product/, as otherwise I am essentially sending the data twice. Once here, and once in my ajax function. </p> <p>Here is my view</p> <pre><code>&lt;form class="buy-product-form" id="{{$product-&gt;id}}" action="{{url('/UoE/buy-product')}}" method="POST"&gt; {{csrf_field()}} &lt;button class="pull-right btn btn-primary"&gt;BUY NOW&lt;/button&gt; &lt;/form&gt; </code></pre> <p>Here is my AJAX function </p> <pre><code>$(document).ready(function(){ $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } }); $('form.buy-product-form').on('submit', (function (e) { e.preventDefault(); var product_id = $(this).closest("form").attr("id"); $.ajax({ url: $(this).closest("form").attr('action'), type: 'POST', data: {'id': product_id}, dataType: 'JSON', success: function () { window.alert($(this).closest("form").attr('action')); } }); })); }); </code></pre> <p>Here is the first line of my controller (everything else here works fine) </p> <pre><code> public function buyProduct(Request $request){ $product_id = $request-&gt;id; </code></pre> <p>And here is my routes.php file </p> <pre><code>Route::post('/{university_code}/buy-product', 'UserController@buyProduct'); </code></pre> </div>

将输入从使用JavaScript和AJAX的HTML表单传递到PHP POST方法

<div class="post-text" itemprop="text"> <p>I have a form with several inputs using Bootstrap and JavaScript that I need to pass to my PHP script using the POST method. </p> <p>My JavaScript: </p> <pre><code>$(document).ready(function() { $("#contact_form") .bootstrapValidator({ feedbackIcons: { valid: "glyphicon glyphicon-ok", invalid: "glyphicon glyphicon-remove", validating: "glyphicon glyphicon-refresh" }, fields: { name: { validators: { stringLength: { min: 2 }, notEmpty: { message: "message" } } }, n2: { validators: { stringLength: { min: 2, message: "message" }, notEmpty: { message: "message" } } }, n3: { validators: { stringLength: { min: 3, message: "message" }, notEmpty: { message: "message" }, } }, n4: { validators: { stringLength: { min: 18, message: "message" }, notEmpty: { message: "message" }, } }, puesto: { validators: { stringLength: { min: 4, message: "message" }, notEmpty: { message: "message" } } }, n6: { validators: { stringLength: { min: 4, message: "message" }, notEmpty: { message: "message" } } }, n7: { validators: { stringLength: { min: 4, message: "message" }, notEmpty: { message: "message" }, } }, } }) .on("success.form.bv", function(e) { $("#success_message").slideDown({ opacity: "show" }, "slow"); // Do something ... $("#contact_form").data("bootstrapValidator").resetForm(); // Prevent form submission e.preventDefault(); // Get the form instance var $form = $(e.target); console.log($form); // Get the BootstrapValidator instance var bv = $form.data("bootstrapValidator"); // Use Ajax to submit form data $.post( $form.attr("action"), $form.serialize(), function(result) { console.log(result); }, "json" ); }); </code></pre> <p>});</p> <p>This is the type of form am using: </p> <pre><code>&lt;div class="container"&gt; &lt;script src="ce.js"&gt;&lt;/script&gt; &lt;form class="well form-horizontal" action=" " method="post" id="contact_form"&gt; &lt;fieldset&gt; &lt;!-- Form Name --&gt; &lt;legend&gt;Title&lt;/legend&gt; &lt;!-- Text input--&gt; &lt;div class="form-group" action="actualizar.php" method="post"&gt; &lt;label class="col-md-4 control-label"&gt;Nombre&lt;/label&gt; &lt;div class="col-md-4 inputGroupContainer"&gt; &lt;div class="input-group"&gt; &lt;span class="input-group-addon"&gt;&lt;i class="glyphicon glyphicon-user"&gt;&lt;/i&gt;&lt;/span&gt; &lt;input name="name" placeholder="Name" class="form-control" type="text" id="name"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- Several other forms below this --&gt; </code></pre> <p>I need to obtain the input in my PHP like this; </p> <pre><code>&lt;?php $var = $_POST['name']; echo $var; ?&gt; </code></pre> <p>I have all the code in one PHP file.</p> <p>Its currently not obtaining data in the POST, I know the AJAX in the JS is using a post method but I have no clue of how to access that data. I appreciate all your help.</p> </div>

使用ajax从表单传递aid的当前行值

<div class="post-text" itemprop="text"> <p>I am working in wordpress and I want to fetch the updated value of aid field from form each time a submit button is pressed. There are two submit buttons and I want the id as per the clicked row</p> <p>HTML Form(it is shown dynamically with php code)</p> <pre><code>foreach( $results as $result ) { $form.= '&lt;form id="voteform" action="" method="post"&gt;'; $form.= "&lt;input id='aid' name='aid' type='text' value='$result-&gt;aid'&gt;"; $form.=" &lt;input class='star' class='star' id='star5' type='submit' name='star5' value='5'&gt;"; $form.=" &lt;input class='star' class='star' id='star6' type='submit' name='star5' value='5'&gt;&lt;/form"; </code></pre> <p>jQuery</p> <pre><code>$(document).on("click",".star", function(e) { e.preventDefault(); var aidd = jQuery("#aid").val(); sentdata =({ action: 'star', aid:aidd, }) $.post(yes.ajaxurl, sentdata, function (res) { //start of funciton alert(aid); $("#myresult").html(res); return false; } //end of function , 'json'); }); //end inner function }); //end main function </code></pre> <p>php code</p> <pre><code>add_action( 'wp_ajax_star', 'star' ); add_action( 'wp_ajax_nopriv_star', 'star'); function star() { $aid = $_POST['aid']; echo json_encode($aid); die(); } </code></pre> </div>

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

删库了,我们一定要跑路吗?

在工作中,我们误删数据或者数据库,我们一定需要跑路吗?我看未必,程序员一定要学会自救,神不知鬼不觉的将数据找回。 在 mysql 数据库中,我们知道 binlog 日志记录了我们对数据库的所有操作,所以 binlog 日志就是我们自救的利器。 接下来就来开启程序员自救之路。 想要自救成功,binlog 这把利器一定要好,在自己之前,我们一定要确定我们有 binlog 这把利器,以下就是确保有 bi...

再不跳槽,应届毕业生拿的都比我多了!

跳槽几乎是每个人职业生涯的一部分,很多HR说“三年两跳”已经是一个跳槽频繁与否的阈值了,可为什么市面上有很多程序员不到一年就跳槽呢?他们不担心影响履历吗? PayScale之前发布的**《员工最短任期公司排行榜》中,两家码农大厂Amazon和Google**,以1年和1.1年的员工任期中位数分列第二、第四名。 PayScale:员工最短任期公司排行榜 意外的是,任期中位数极小的这两家公司,薪资...

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

华为初面+综合面试(Java技术面)附上面试题

华为面试整体流程大致分为笔试,性格测试,面试,综合面试,回学校等结果。笔试来说,华为的难度较中等,选择题难度和网易腾讯差不多。最后的代码题,相比下来就简单很多,一共3道题目,前2题很容易就AC,题目已经记不太清楚,不过难度确实不大。最后一题最后提交的代码过了75%的样例,一直没有发现剩下的25%可能存在什么坑。 笔试部分太久远,我就不怎么回忆了。直接将面试。 面试 如果说腾讯的面试是挥金如土...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

外包程序员的幸福生活

今天给你们讲述一个外包程序员的幸福生活。男主是Z哥,不是在外包公司上班的那种,是一名自由职业者,接外包项目自己干。接下来讲的都是真人真事。 先给大家介绍一下男主,Z哥,老程序员,是我十多年前的老同事,技术大牛,当过CTO,也创过业。因为我俩都爱好喝酒、踢球,再加上住的距离不算远,所以一直也断断续续的联系着,我对Z哥的状况也有大概了解。 Z哥几年前创业失败,后来他开始干起了外包,利用自己的技术能...

现代的 “Hello, World”,可不仅仅是几行代码而已

作者 |Charles R. Martin译者 | 弯月,责编 | 夕颜头图 |付费下载自视觉中国出品 | CSDN(ID:CSDNnews)新手...

!大部分程序员只会写3年代码

如果世界上都是这种不思进取的软件公司,那别说大部分程序员只会写 3 年代码,恐怕就没有程序员这种职业。

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

HTTP与HTTPS的区别

面试官问HTTP与HTTPS的区别,我这样回答让他竖起大拇指!

程序员毕业去大公司好还是小公司好?

虽然大公司并不是人人都能进,但我仍建议还未毕业的同学,尽力地通过校招向大公司挤,但凡挤进去,你这一生会容易很多。 大公司哪里好?没能进大公司怎么办?答案都在这里了,记得帮我点赞哦。 目录: 技术氛围 内部晋升与跳槽 啥也没学会,公司倒闭了? 不同的人脉圈,注定会有不同的结果 没能去大厂怎么办? 一、技术氛围 纵观整个程序员技术领域,哪个在行业有所名气的大牛,不是在大厂? 而且众所...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

立即提问
相关内容推荐