使用jQuery编辑多个输入

I've got a dynamic multiple text input:

<input type="text" id="text_1">
<input type="text" id="text_2">
<input type="text" id="text_3">
<input type="text" id="text_4">
<input type="text" id="text_5"> ....

How do I get the id on each textinput with jQuery to edit:

$('#form').submit(function(){
  $.post('include/setting.php', {
    text_(id): $('#text_(id)').val(), // <--
  }, 'json')
  return false;
})

And with php how do I get the input id?

Use serialize()

$('#form').submit(function(){
  $('#form input[id]').each(function(){
   $(this).attr('name', $(this).attr('id'));
  });
  $.post('include/setting.php', $('#form').serialize());
  return false;
})

First of all, to share the information with php, you need to send that ajax data with get or post, which means that in php you'll be accepting the data with $_REQUEST['url_var_name'] (which accepts either). For example:

$requests = array('name', 'time', 'city'); // Request whitelist.
$params = array(); // Empty array to hold the final values.
foreach($requests as $param){
    $params[$param] = @$_REQUEST[$param]; // Null by default.
}
// End up with an array of whitelisted parameters in $params to cast or restrict.

Secondly, since you're selecting multiple elements, you might want to either use a class on all the elements and then iterate over them with jQuery .each(), or just select for input elements within a certain div, to make things simpler. For example:

<div id='#name-inputs'>
<input type="text" id="text_1">
<input type="text" id="text_2">
<input type="text" id="text_3">
<input type="text" id="text_4">
<input type="text" id="text_5">
</div>

Then you would interact with the inputs via $('#name-inputs input') instead of pulling them individually by id. In that way you can really name the inputs whatever you want without limiting them to a numeric looping scheme.

Edit: @ARTStudio's suggestion on serialize() is probably even better than dealing with the inputs individually in the javascript (new function to me, I like it).