Passing javascript variable to PHP variable |
[eluser]1mr3yn[/eluser]
Good day,, Im using the jquery modal form.,. I have a problem with this JavaScript and php hope someone help me..Im trying to pass a variable from javascript to PHP, I tried a lot but it did'nt work.,. Here's my sample code: $("#dialog").dialog({ bgiframe: true, autoOpen: false, height: 300, modal: true, buttons: { 'Add New Partner': function() { var bValid = true; allFields.removeClass('ui-state-error'); bValid = bValid && checkLength(cat,"Category",1,4); bValid = bValid && checkLength(code,"Partner Code",1,5); bValid = bValid && checkLength(desc,"Description",5,20); bValid = bValid && checkRegexp(code,/^([0-9a-zA-Z])+$/,"Product Code only allow : a-z 0-9 "); bValid = bValid && checkRegexp(desc,/^([0-9a-zA-Z])+$/,"Description field only allow : a-z 0-9"); if (bValid) { // Here's the main problem // insert the value from cat.val(), code.val() and desc.val() into the database table $(this).dialog('close'); } }, Cancel: function() { $(this).dialog('close'); } }, close: function() { allFields.val('').removeClass('ui-state-error'); } });
[eluser]1mr3yn[/eluser]
and im currently using codeigniter for this whole stuff...
[eluser]ok3x[/eluser]
As I see it, your jQ code runs on the presentation side (the browser). And the CI resides on the server side. So you have to pass the data along. While using jQ, I suggest you make an ajax request: Code: if (bValid) { And at the server side: Quote:function handle()
[eluser]Unknown[/eluser]
Can be an article from this site will help you : Passing Javascript variable to php |
Welcome Guest, Not a member yet? Register Sign In |