Solved

Jquery and passing load variables onclick

Posted on 2013-01-19
8
230 Views
Last Modified: 2013-01-22
Hi Guys,

Can anyone suggest why this isnt working?

$(".Suggestion").click(function() {
	SuggestedCompany = $(this).text();
	$('#Company').val(SuggestedCompany)
	$('#ExtraDetails').load('/lists/scripts/php/load.extra.php?Company='+SuggestedCompany+'');

});

Open in new window


It adds the value to the input perfectly... but doesnt load the file correctly

Many Thanks for help
0
Comment
Question by:maccaj51
  • 4
  • 4
8 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 38796709
what mean but doesnt load the file correctly
0
 

Author Comment

by:maccaj51
ID: 38796715
It removes content in #ExtraDetails so I assume the load function is working...

However it doesnt load the content of load.extra.php, regardless of passed variable
0
 
LVL 82

Expert Comment

by:leakim971
ID: 38796967
It removes content in #ExtraDetails so I assume the load function is working...
yes that's the goal of using load

However it doesnt load the content of load.extra.php, regardless of passed variable
OK, could you propose a link to see your page?
Try this and let me know what you get in the alert box
$(".Suggestion").click(function() {
	SuggestedCompany = $(this).text();
	$('#Company').val(SuggestedCompany)
var url = '/lists/scripts/php/load.extra.php?Company='+SuggestedCompany+'';
alert( url );
	$('#ExtraDetails').load(url);

});

Open in new window

0
 

Author Comment

by:maccaj51
ID: 38806593
Hi Leakim,

Sorry for delay...

That alerts the correct information...

/lists/scripts/php/load.extra.php?Company=ACAL BFI UK
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:maccaj51
ID: 38806635
If i change the load url from:

var url = '/lists/scripts/php/load.extra.php?Company='+SuggestedCompany+'';

to a manual entry of:

var url = '/lists/scripts/php/load.extra.php?Company=test';

the load works fine...

Cant understand it
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 38806637
ok replace :
SuggestedCompany = $(this).text();
by :
SuggestedCompany = encodeURIComponent( $(this).text() );
0
 

Author Closing Comment

by:maccaj51
ID: 38806646
You Sir are a Hero!
0
 
LVL 82

Expert Comment

by:leakim971
ID: 38806652
the error is due to the space

$("#where_to_put").load("url_to_load   what_to_get_from_page_loaded"); // see the space here
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now