Trying a bit of AJAX, and I find that much of my data is littered with underscores! Documentation confirms that this is working as intended. Any way to pass my form information to PHP intact? I'm using CodeIgniter, so my pass looks like /controller/function/variable, receiving controller:
controller{
function($v=0){#what once was hello world is now hello_world...}
}
I can't very well do an undo, data might contain an underscore.
Thanks, Brandon
Edit:
I think it is converting the value. Here is the gist of the code:
<form>
<text input name="tbox"/>
<submit/>
</form>
ajax_handler(
v = form.name() + form.val()
do_ajax('/controller/function/v')
)
controller(){
function($v=0){#spaces and periods in v are converted to underscore}
}
thanks again, brandon
here is the actual code:
<input type="text" id="tusername" name="tusername" class="checkable tbox"/>
<button id="unsubmit" name="wizard" class="formable">next</button>
$('.formable').live('click',function(event){
event.preventDefault();
var n = $(this).attr('id');
var a = $(this).attr('name');
var v = dosend();
$.ajax({
url: '/form/'+n+'/'+v,
type: 'post',
success: function(result){
alert(result);
}
});
function dosend(){
var inputs = $(":input");
var s = "";
inputs.each(function(){
s += $(this).attr('name')+":";
s += $(this).val()+";";
});
return s;
}
});
class Form extends Controller{
function Form(){
parent::Controller();
session_start();
}
function unsubmit($v=6){
print $v;
}
}
anything in the string that gets passed to the controller's function that is a space or period gets converted to underscore. I type hello world into this box, and it prints out hello_world.
$w = explode(';',$v);
foreach($w as $i){
$x = explode(':',$i);
if(isset($x[1])){
$_AJAX[$x[0]] = $x[1];
}
}