Search code examples
jqueryjquery-load

jquery .load() loading whole page instead of an element. Is that right?


if I do this:

$('#myDiv').load('/somepage.aspx #someDiv #someOtherDiv', function(data){
    console.log(data);
});

In the console I see the whole page code, instead of the contents of #someDiv #someOtherDiv.

Is that right?

Thanks.


Solution

  • Yes, thats right. jQuery loads the whole page, but gets only the requested elements (#someDiv #someOtherDiv in your case) from it.