Hello,
I do struggle with it as hell. Can someone tell me what is wrong with that code.
In a word: CI + jquery form submit. I try to add inline row.
java part
var pair = $('#pair').attr('value'); var entry = $('#entry').attr('value'); var exit = $('#exit').attr('value'); var buysell = $('#buysell').attr('value'); var pl = $('#pl').attr('value'); var dataString = 'pair='+ pair +'&entry='+ entry +'&exit='+ exit +'&buysell='+ buysell +'&pl='+ pl; $("form#submit").submit(function() { $.ajax({ type: "POST", url: "<?php echo base_url();?>journal/add", data: dataString, success: function(){ $("#message").text("Added").fadeOut(4000, function() { $(this).css('display','block').text(""); }); } }); });
controller part (works if not using java, and yet it's too simple not to work)
$data['pair'] = htmlspecialchars(trim($_POST['pair'])); $data['entry'] = htmlspecialchars(trim($_POST['entry'])); $data['exit'] = htmlspecialchars(trim($_POST['exit'])); $data['buysell'] = stripslashes(trim($_POST['buysell'])); // Insert_data $this->journal_model->add_trade($data);
If someone will be able to help, please do... :(
Cheers,
/Jacek