anonymous123
anonymous123

Reputation: 1285

Need help with ajax

so I have created a link and am using jquery and ajax to load a new web page using this link, now is there anyway where I can change some content on this dynamically loaded page?
For example, the new page has a drop-down list, so can I somehow set the value of this drop-down list.

I tried to using the following in the load function

$('#content').load("inq.html #content",function(){
('selectid').val('optionvalue'); 
});

The selectid and optionvalue are in the loaded page.
This did not work.

Upvotes: -1

Views: 59

Answers (2)

Nathan Romano
Nathan Romano

Reputation: 7106

your url appears to be malformed. something like "/inq.html#html"

http://api.jquery.com/load/

Upvotes: 1

Daff
Daff

Reputation: 44215

It should work. In your example you forgot the jQuery object and didn't have the correct selector in the callback:

$('#content').load("inq.html #content",function(){
    $('#selectid').val('optionvalue'); 
});

Upvotes: 1

Related Questions