Thursday, 15 January 2015

php - JQUERY AJAX for each loop custom attributes -



php - JQUERY AJAX for each loop custom attributes -

this question related 1 asked yesterday , link is: parse html in jquery through ajax elements , replace each corresponding on page

basically want phone call php page ajax , replace elements in response corresponding ones on page. got next function in answer:

$(data ).filter('.maindiv').each(function (index) /* "this" current div in response*/ $('#'+this.id).replacewith(this); });

the above function woeks when div want replace has regular id= if utilize custom attribute gid= illustration won't work. how can prepare this??

thanks

you can select node gid attribute with:

$('[gid]').replacewith(this);

you can more precise selecting node has gid value want

$('[gid="hello"]').replacewith(this);

hope helps

php javascript jquery html ajax

No comments:

Post a Comment