How to insert a div from one page into a div on current.
My method using .Load below was working but has stopped and I am unsure why.
$("#button").on('click', function() {
$("#div").load('../url.aspx #div2');
});
How to insert a div from one page into a div on current.
My method using .Load below was working but has stopped and I am unsure why.
$("#button").on('click', function() {
$("#div").load('../url.aspx #div2');
});
The .load() you are using isn't deprecated - you are thinking of the load event.
In regard to your code - it should be working. You mentioned that it worked sometimes when trying with on()
but not with it's shortcut click()
- maybe you can try refreshing your browser cache or look at other parts of your code that you feel may be causing this (maybe what you're trying to load)?
The event load is deprecated as of 1.8.
The load which you are asking about is not deprecated and can still be used without worry.
If for some reason you still want to replace load
, you can use any number of other methods: ajax
, get
, etc.