javascript - passing parameter to function -


i want pass parameter function. if pass id parameter working. want pass string value parameter function. want add escape sequence parameter. if pass $fet['cf_id'] parameter working. if pass $fet['file_name'] value, not passed.

$file1=$fet['file_name']; $ef=$fet['cf_id']; $next1 = basename($file1); echo '<td style="text-align:center;width:100px;"><img src="image/delete1.png" alt="delete" style="width:10px;height:10px" title="remove" onclick="myfunction('.$fet['file_name'].');"></td></tr>'; function myfunction(cid) {        // alert(cid);     var  rmvfile=cid;     //display conformation box     if (confirm("are sure want delete file?") == true) {         if(cid!='')         {             $.ajax({                 type:'post',                 url:'delete_cli_file.php',                 data:{rmvfile: rmvfile},                 success:function(msg){                     if (msg.length> 0) {                         alert(msg);                         location.reload();                     }                 }             });         }     } } 

where pass text javascript must in 'text'.

       $file1 =$fet['file_name'];        $a     ="'";        $ef    =$fet['cf_id'];        $next1 = basename($file1);        echo '<td style="text-align:center;width:100px;">              <img src="image/delete1.png" alt="delete"                style="width:10px;height:10px"                title="remove"               onclick="myfunction('.$a.$fet['file_name'].$a.');">              </td></tr>';       function myfunction(cid)      {            // alert(cid);         var  rmvfile=cid;         //display conformation box         if (confirm("are sure want delete file?") == true)                {          if(cid!='')          {            $.ajax({            type:'post',            url:'delete_cli_file.php',            data:{rmvfile: rmvfile},            success:function(msg)            {              if (msg.length> 0)               {                 alert(msg);                 location.reload();              }            }       });       }} } 

Comments