Submitting HTML form without hidden input field [on hold]

207
December 17, 2017, at 5:59 PM

Is it possible to submt an HTML form without passing a hidden input field which references an id of the record being updated/inserted?

edit: sorry for not being clear earlier. I was wondering if it is possible to submit a form in PHP or javascript without passing any id in the url or using any hidden input attribute in the form to specify the record or user being updated.

Answer 1

you can use ajax for this actually. I would have recommended passing the variables using ? and & next to the url on submit but that would be an ugly approach.

Using Ajax

<form id='formID'>
</form>
<script>
$('#formID').submit(function(e){
var value = 1;
e.preventDefault();
   $.ajax({
   data:{key : value}, //pass your variables here as key value.
   url '';//endpoint of this
   type: 'POST'
     success:function(result){
      alert('All good');
     },
   });
});
</script>
Answer 2

one way to pass id using url without hidden field like

<form method="post" action="http://example.com?id=5"> 
Rent Charter Buses Company
READ ALSO
Vue v-model not updating array values while using v-for

Vue v-model not updating array values while using v-for

I'm new to Vue, and am playing around with v-model to see what I can createI want to make an editable array of names

458
Reading JSON Files with Numbers as Field Names in JavaScript

Reading JSON Files with Numbers as Field Names in JavaScript

I'm trying to read data from a JSON file retrieved from an API, but the API has each category sorted using numbers as titlesMy IDE (Atom, if that's relevant) does not like this and gives me a syntax error despite the fact that it uses the correct syntax...

226
How to use Javascript in a Node.js app to get external webpage info/webscraping?

How to use Javascript in a Node.js app to get external webpage info/webscraping?

I am using the Twit API for Nodejs, and have hosted my code on Heroku, which is where it is currently running from

216
To get the notification while changing the inner html of UIWebView

To get the notification while changing the inner html of UIWebView

We are changing the UIWebView inner html using the following code

210