@@ -328,26 +328,42 @@ <h2>👨🔧 Request Expert Advice</h2>
328328 // Data foomii irraa fudhu
329329 let name = document . getElementById ( 'name' ) . value ;
330330 let msg = document . getElementById ( 'msg' ) . value ;
331-
332- // Linkii Web App URL kee (Isa Google Script irraa argatte)
333- const scriptURL = 'https://script.google.com/macros/s/AKfycbyORulxCa8xW7yBl8VN0sRM3J6aCPT06VVNDsgySzXNokZ-r5UuxD0jMI7BahmI091YoQ/exec' ;
331+ < script >
332+ const scriptURL = 'https://script.google.com/macros/s/AKfycbwGMElmpmkPy1no4eGEknf3dsBbaRTR0oAwp4OT_jk6O-xXglYfhTFpwxBU7721zaT6/exec';
334333
335- let customerData = {
336- name : name ,
337- issue : msg ,
338- temperature : "Diagnostic Checked"
339- } ;
334+ async function submitToDatabase(event) {
335+ event . preventDefault ( ) ;
336+
337+ let name = document . getElementById ( 'name' ) . value ;
338+ let msg = document . getElementById ( 'msg' ) . value ;
339+
340+ let customerData = {
341+ name : name ,
342+ issue : msg ,
343+ temperature : "Diagnostic Checked"
344+ } ;
345+
346+ try {
347+ // Data gara Google Sheets erguu
348+ await fetch ( scriptURL , {
349+ method : 'POST' ,
350+ mode : 'no-cors' ,
351+ body : JSON . stringify ( customerData )
352+ } ) ;
340353
341- try {
342- // Data gara Google Sheets erguu
343- fetch ( scriptURL , {
344- method : 'POST' ,
345- mode : 'no-cors' ,
346- headers : { 'Content-Type' : 'application/json' } ,
347- body : JSON . stringify ( customerData )
348- } ) ;
354+ alert ( "✅ Injifannoo! Odeeffannoon kee Database keessatti galmeeffameera." ) ;
355+
356+ // Gara WhatsApp tti erguu
357+ window . open ( `https://wa.me/251904267186?text=Hello Abdurhaman, I am ${ name } . Issue: ${ msg } ` , '_blank' ) ;
358+
359+ } catch ( error ) {
360+ alert ( "❌ Error: Database waliin walitti hidhamuu hin dandeenye." ) ;
361+ }
362+ }
363+ </ script >
364+
349365
350- alert ( "✅ Galatoomi Abdurhaman! Odeeffannoon kee Database irratti kuufameera." ) ;
366+ < script > alert ( "✅ Galatoomi Abdurhaman! Odeeffannoon kee Database irratti kuufameera." ) ;
351367
352368 // Kalleattiin gara WhatsApp tti geessi
353369 let whatsappURL = `https://wa.me/251904267186?text=Hello Abdurhaman, I am ${ name } . Issue: ${ msg } ` ;
0 commit comments