How to update two database table through one ajax request

121 Views Asked by At

I have this nested JSON data object:

var obj = {  
   "ARCHIVE":"",
   "CREATED_BY":"Admin",
   "DESCRIPTION":"Some desc",
   "ID":"8d4d7a7f-52f5-434a-b66c-12088b32",
   "daySchedulesT":[  
      {  
         "DS_ID":"8d4d7a7f-52f5-434a-b66c-12088b32",
         "LANGUAGE_ID":"EN",
         "LONG_TEXT":"Some long desc"
      }
   ]
}

So I want to update two tables in my database. One table is daySchedules and the second is daySchedulesT.

Table daySchedules have fields:

  • ID
  • ARCHIVE
  • CREATED_BY
  • DESCRIPTION

where ID is primary key.

Table daySchedulesT have fields:

  • DS_ID
  • LANGUAGE_ID
  • LONG_TEXT

where DS_ID is primary key.

There is also relationship between them, I have foreign key ID -> DS_ID. I want through one Ajax request update this two table.

Is that possible? And if it is, how I can do that? Thanks!

0

There are 0 best solutions below