2013-03-22 32 views
0
$.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); 
    } 
}); 

我想將url的結果括在單引號或雙引號中; e.g在jQuery中連接引號php和javascript函數

'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)" 
+0

'+ JSON.parse(item.UserID)'?你想用這個做什麼? – Musa 2013-03-22 18:26:22

回答

0

試試這個

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

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

試試這個:

$.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); 
    } 
}); 

,而不是PHP串聯.採用javascript串聯+