ajax update using jQuery to external file


I have this within a file called 'product-scores.php' but I want to update the innerHTML of another file (on the same server) like so:

...$('admin_includes/ajax.htm#get_percent_conds_actives').text(data.active_ids+' ').show(1);

View the other code too. Can I do this? How do I check that this ajax.htm file was updated. I'm familiar with firebug but I don't know how to check another external file if it's possible for the ajax update. As well, I don't think that code seems to work but I can't check if the code is updated or not.

            type : 'POST',
            url : 'get_selected_product_info.php',
            dataType : 'json',
            data: {
                product_id : prod_id,
                product_type_id : product_type_id
            success : function(data){
                var cntActiveIds = data.active_ids.length;
                $('admin_includes/ajax.htm#get_percent_conds_actives').text(data.active_ids+' ').show(1);
            error : function(XMLHttpRequest, textStatus, errorThrown) {

Open in new window

Victor KimuraSEO, Web DeveloperAsked:
Who is Participating?
Terry_focusConnect With a Mentor Commented:

You can not use JavaScript/jquery to update files, you'll have to add another php file to update the actual text in another file. JavaScript is client side only and can not interact with files on the server other than AJAX requests, which only fetch data.

If you are trying to update another window in the browser, you can do this by changing the context of the jQuery selector to that of the other window
Victor KimuraSEO, Web DeveloperAuthor Commented:

Thanks for that info. I'm wondering if you know of an example of how I can update the context of another window using the jQuery selector. I browsed the site but didn't see an actual example to select another window. Just curious for future use.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.