how bad it is to use fields input when receiving get

how bad it is to use fields input when receiving get

olvaolva Posts: 17Questions: 7Answers: 0

Hi!
The question is this: There is a table with forms in each row.

"columns": [
                {"data": "prod_name"},
{
                        "data": null,
                        "targets": -1,
                        "defaultContent":
                            "<form action='start-data-submit'> <input  name=\"prod_barcode\" />"
                    },
                    {
                        "data": null,
                        "targets": -1,
                        "defaultContent":
                            " <input name=\"prod_quantity\"/>"
                    },
                  
                    {
                        "data": null,
                        "targets": -1,
                        "defaultContent":
                            " <input name=\"prod_price\" />"
                    },
                    {"data": "id", "visible": false, "searchable": false},
                    {"data": "updated_at", "visible": false, "searchable": false},
                    {
                        "data": null,
                        "defaultContent": " <button name=\"submit\" >Update</button> </form>"
                    },
]

on click in the form, the following is processed:


$('#start-data tbody').on('click', 'button', function () {//click update var row = $(this).closest('tr'); var data = table.row(row).data().id; var info = table.row(row).$("input[name='prod_barcode']").val(); var infoq = table.row(row).$("input[name='prod_quantity']").val(); var infop = table.row(row).$("input[name='prod_price']").val(); var url = "start-data-submit/" + "id=" + data + "&prod_barcode=" + info + "&prod_quantity=" + infoq + "&prod_price=" + infop + " "; $(location).attr('href', url);

or this approach is not correct and you only need to use an editor. Variables I get in the address bar, but with a further sql query table is not updated.

rezult var_dump:

object(Carbon\Carbon)#344 (3) { ["date"]=> string(26) "2020-07-17 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } string(14) "prod_barcode=2" string(15) "prod_quantity=4" string(13) "prod_price=78" string(7) "id=4680"

where else to dig? Any ideas would be very grateful. )

Answers

  • olvaolva Posts: 17Questions: 7Answers: 0

    problem solved

    var url = "start-data-submit/" + data + "/" + info + "/" + infoq + "/" + infop;
    
    
This discussion has been closed.