I'll start right from the start. I am creating a wordpress wordpress plugin that does dual purpose, for the reason that it may be placed in a publish using a shortcode, or added like a sidebar widget. All it will is output some js to create jquery.publish demands to some local php file. The neighborhood php file constitutes a request to some webservice for many data. (I needed to get it done by doing this rather than directly querying the net service with jquery.ajax since the url consists of permission key that might be public if make the js).

Anyway, After I am viewing a webpage within the wordpress blog which has both sidebar widget and also the wordpress plugin output via shortcode only among the demands work. I am talking about it really works for the reason that it will get an answer back in the php script. When the page is loaded both of them work normally when by hand told to.

Web page view -> send 2 publish demands to my php script -> both elements ought to be filed in, only the first is.

My php script is simply:

<?php
    if(isset($_POST["zip"])) {
         // build a curl object, execute the request, 
         // and basically just echo what the curl request returns.
    }
?>

Pretty fundamental.

here's some js many people desired to see:

function widget_getActivities( zip ){
    jQuery("#widget_active_list").text("");
    jQuery.post("http://localhost/wordpress/wp-content/ActiveAjax.php", { zip: zip}, 
		function(text) {
			jQuery(text).find("asset").each(function(j, aval){
				var html = "";
				html += "<a href='" + jQuery(aval).find("trackback").text() + "' target='new'> " +  jQuery(aval).find("assetName").text() + "</a><b> at </b>";

				jQuery("location", aval).each(function(i, val){
					html += jQuery("locationName", val).text() + " <b> on </b>";
				});

				jQuery("date", aval).each(function(){
					html += jQuery("startDate", aval).text();
				<!--jQuery("#widget_active_list").append("<div id='ActivityEntry'>" + html + " </div>");-->
				jQuery("#widget_active_list")
					.append(jQuery("<div>")
						.addClass("widget_ActivityEntry")
						.html(html)
						.bind("mouseenter", function(){
							jQuery(this).animate({ fontSize: "20px", lineHeight: "1.2em" }, 50);  
						})
						.bind("mouseleave", function(){
							jQuery(this).animate({ fontSize: "10px", lineHeight: "1.2em" }, 50);  
					})
					);

				});
			});
		});
}

Imagine there's another function just like that one except everything that's prepended with 'widget_' is not prepended. Both of these functions get known as individually via:

jQuery(document).ready(function(){
    w_zip = jQuery("#widget_zip").val();
	widget_getActivities( w_zip );
	jQuery("#widget_updateZipLink").click(function() { //start function when any update link is clicked
		widget_c_zip = jQuery("#widget_zip").val();
		if (undefined == widget_c_zip || widget_c_zip == "" || widget_c_zip.length != 5)
			jQuery("#widget_zipError").text("Bad zip code");
		else
			widget_getActivities( widget_c_zip );

	});
})

I can tell during my apache logs that both demands are now being made. I am speculating it's some kind of race condition but that does not make Sense at all. I am a new comer to all of this, any ideas?

EDIT: I have develop a sub-optimal solution. I've my widget identify when the wordpress plugin may also be utilized on the page, and when therefore it waits for 3 seconds before carrying out the request. But I've got a feeling this same factor will happen if multiple clients execute a page request simultaneously that creates among the demands to my php script, because In my opinion the issue is within the php script, that is frightening.