ajax update using jQuery to external file

Hi,

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.

Thanks,
Victor
$.ajax({
            type : 'POST',
            url : 'get_selected_product_info.php',
            dataType : 'json',
            data: {
                product_id : prod_id,
                product_type_id : product_type_id
            },
            success : function(data){
                $('#display_selected_product_info').html(data.display_product_info).show(500);
                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) {
                $('#display_selected_product_info').text(textStatus).show(500);
            }
        });

Open in new window

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

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
http://api.jquery.com/jQuery/
0
 
Victor KimuraSEO, Web DeveloperAuthor Commented:
Hi,

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.

Thanks,
Victor
0
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.