I am trying to send two variable by AJAX to PHP,
$('#add_news').on( 'click',function () {
var news_subject = $('#news_subject').val();
var news_content = $('#summernote_1').code();
console.log(news_subject);
console.log(news_content);
jQuery.ajax({
url: "<?php echo base_url(); ?>index.php/admin/news/add_news",
data: "news_subject="+ news_subject + "news_content="+ news_content,
type: "POST",
success:function(data){
}
});
but while submitted this, i get like below,
news_subject:Testnews_content=Hello,
How can i seperate two variable news_subject and news_content, so that my PHP controller can get post value and send to DB, Currently it go as one variable new_subject and value is --Testnews_content=Hello.
I assume something wrong in data: but i dont know how to send two variable in one data, Can you help,
Thanks,
&in the data line... change it to this:data: "news_subject="+ news_subject + "&news_content="+ news_content. Notice the&beforenews_content...