Add, modify, delete operation ideas in the background of the website

The PHP background often develops the functions of adding, modifying, and deleting background functions. I have two ideas!

1. The first is to determine whether the val() of the id is greater than 0

1. After clicking the Add button, set the val of the popup template #id to 0; [Add]

<input id="id" type="hidden" value="0">

After the add button is clicked, set the val of #id to empty, and then execute the operation of the pop-up window. After clicking the submit button, execute the add event

When adding, it should be noted that the template of the table must be cloned and appended.

The content of the form template is replaced with the data returned by the interface.

2. Click the Modify Address button

Replace the val() values ​​of #id and #name of the popup template with the existing content of the table

Determine whether his id value is greater than 0 if(id >0){

// perform the modification operation

Submit the modified content, and the table content becomes the content returned by the submission interface

}

Second, determine whether the id exists

Click Add event to set the val() of #id and #name in the pop-up window to "";

Clicking the modification event is to set the val() of #id and #name in the pop-up window to the id and name in $(this).parents("tr")

if(!data.id){

//Execute the add event

}else{

// execute the modification event

}

 

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326941838&siteId=291194637