...

View Full Version : ajax call is not showing correctly



esthera
09-20-2011, 12:56 PM
i'm doing the following on a select box to load the next select box (in a td with the id)



if I look at the html returned by the ajax call I get


<select name=optionvalue /><option value='test 1'>test 1</option><option value='test 2'>test 2</option><option value='test 3'>test 3</option></select>

but it's showing as

the select box and then

test 1test 2test 3


my javascript code is


function Loadoptionvalueselect() {
//alert("here");
urltoajax = "getoptionsvaluesselect.asp?1=1"
strarea = document.getElementById('optionid').value;



urltoajax = urltoajax + '&optionid=' + strarea
urltoajax = urltoajax + '&rnd=' + Math.round(Math.random() * 10000)
// alert(urltoajax);
$.ajax({
url: urltoajax,
cache: false,
success: function(html) {
$("#troptionvalue").html(html);
}
});

}

any ideas what could be causing this?

devnull69
09-20-2011, 05:11 PM
Yes it's actually quite simple

with /> you are closing the select tag already. Just omit the /

morongo47
09-20-2011, 05:12 PM
I don't know if this might have anything to do with it, but it looks like your first <select> is being closed before you get to your options:

[code]
<select name=optionvalue /> (prematurely closed?)
<option value='test 1'>test 1</option>
<option value='test 2'>test 2</option>
<option value='test 3'>test 3</option>
</select>
[code]

esthera
09-21-2011, 07:00 AM
thanks you spotted it - that was the problem



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum