Laravel表单不发送动态生成内容的请求

I have a form like this:

<form class="form-horizontal" role="form" method="POST" name="myform" id="myform" action="{{ url('/mypage/') }}">
        {{ csrf_field() }}
<div id="somecontent">
</div>
<div id="abutton">
</div>
</form>

Then some Jquery like this:

 $('#somecontent').html('<select class="form-control" id="myselect"  form="my"><option value="1">Hello</option><option value="2">World</option></select>');

And then I add a button like this:

button = $('<button type="submit" form="myform" class="btn btn-theme">Send</button>');

$('#abutton').html(button);

And I also change the action dynamically:

 $("#myform").attr("action","/mypage/" + item_id);

Then I got this in the web file:

Route::post('/mypage/{item_id}','mycontroller@do_something');

And then do this in the controller:

public function do_something($item_id,Request $request){
dd($request);
}

But the $request is empty, it does not contain the value selected in the dynamically generated select.

Any ideas why?

you haven't added name attribute of select, add name attribute and see it will populate into $request.

Try below code.

 $('#somecontent').html('<select name="select_name" class="form-control" id="myselect"  form="my"><option value="1">Hello</option><option value="2">World</option></select>');