Possible Duplicate:
Could not complete the operation due to error 80020101. IE
I’m facing a little problem with my jQuery code.
I have a first page with some fields like :
[Code 1] [Code 2] [Code 3]
The user type something in one of the input, I get the result that I load in another page with .load method. Here’s the code :
$(function() {
$("#code_cip").autocomplete({
source: tab,
minLength: 6,
delay: 1000,
select: function(event, ui) {
var selectedObj = ui.item;
$("#code_cip_ind").val(selectedObj.value);
$("#test").load("test.php?id="+selectedObj.value);
}
});
});
This, works great. It correctly load the “test.php” page with the good values.
BUT… In the test.php page I have a form, and I try to fill it like this :
test.php :
<?php
$gest_medecin = new gest_medecin($db);
$medecin = $gest_medecin->returnValues();
$adresse = $medecin->Adresse;
echo $adresse // This, output the good value of the attribut
?>
<script>
adresse = <?php echo $adresse;?>;
alert(adresse);
$("#adresse").val(adresse);
</script>
<input name="adresse" id="adresse" type="text" />
The problem is :
When I try to alert the “adresse” var, or use it with my .val method, I get the error 80020101 in IE, and in Firefox, nothing is happening…
I tried to fill the variable with some test string like this :
adresse = <?php echo "123456" ?>
And that works great…
As mentioned I checked that the $medecin->Adresse was correct with my echo and it is. It contains something like “word1 word2”
I really have no clue why my code isn’t working…
Any help ?
Always look at the final result to spot the error.
You are missing quotes around
strings always need quotes.
it worked with
123456because that is an integer value that needs no quotes.Firefox will tell you this in its error console with a better error message.