简体   繁体   English

串联引号jQuery中的php和javascript函数

[英]Concatenate quotes php and javascript function in jQuery

$.ajax({
    type: "POST",
    url: <?php echo base_url().'index.php/user_management/manage_users/ViewProfile/'?>"+JSON.parse(item.UserID),
    success: function(output_string){
        $('.second_column_content_container').html(output_string);
    }
});

I want the result of the url to be enclosed in single or double quotes; 我希望将网址结果用单引号或双引号引起来; eg 例如

'url: <?php echo base_url().'index.php/user_management/manage_users/ViewProfile/'?>"+JSON.parse(item.UserID)' or 
"url: <?php echo base_url().'index.php/user_management/manage_users/ViewProfile/'?>"+JSON.parse(item.UserID)"

try this 尝试这个

url: "<?php echo base_url().'index.php/user_management/manage_users/ViewProfile/'?>"+JSON.parse(item.UserID),
//---^^--here

or 要么

url: "<?php echo base_url() ?>"+'index.php/user_management/manage_users/ViewProfile/'+JSON.parse(item.UserID),

Try this: 尝试这个:

$.ajax({
    type: "POST",
    url: '<?php echo base_url(); ?>'+'index.php/user_management/manage_users/ViewProfile/'+JSON.parse(item.UserID),
    success: function(output_string){
       $('.second_column_content_container').html(output_string);
    }
});

instead php concatenation . 代替php级联. use javascript concatenation + . 使用javascript级联+

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM