if you visit here: Example You will see my problem.
The page loads, then loads all the same content within a div id=content
Have a look at the source for the JS/jQuery and if you need the PHP just let me know. Im not too sure if its the JS or PHP that's doing this. I use the jQuery Address Plugin so maybe im not using it properly but this is killing me.
any ideas on what i could be doing wrong? in Firebug the page loads and simply doesn't stop. Try it out if you have it.
Any help is appreciated!!
This line of code:
$('.content').load('http://laynestaley.co.uk/test/'+fragment+'?ajax=1');
Is actually loading the entire page into <div class='content'></div>. Your server-side code must not be executing the way you expect it to with that AJAX call (It's just loading the index page of /test/ again).
I agree with #Andrew, but just a suggestion -- if you don't want the page to "snap" when the AJAX is loaded, set your height in css to something like 100%
You are incorrectly building fragment. In you code first letter truncated in query.
Correct code:
fragment = event.value.substring(2);
Related
i have check about this question. But still stuck, I am using wordpress and want to insert it in some page or post.
So i have searched and see this code http://jsfiddle.net/akhurshid/NuwE6/ but when i transfer to html or insert in http://liveweave.com/8PQ77Q and nothing happen?
Any idea?
Thanks for your help
You probably don't have jQuery included in your page. For instance, on LiveWeave, you need to add jQuery as a library to see your code working. Just check you have jQuery loaded on your Wordpress website.
I'm building a site where there will be four tiles on the front page. When a tile is selected, I want the content to pop up in like a window that will be a bit transparent so you can see the main page behind it.
I've successfully coded just that, getting the link to bring up another div that is otherwise hidden and I've even gotten it to load another html document. I accomplished this with XMLHttpRequest();. My question is, is there a more efficient way to do this? I know I've done something similar in PHP before in school and when I google, I do see that being a way to do it, but I'm also seeing jQuery and AJAX being mentioned. My overall goal is to get it to where if I want to update the CSS of the screens, that I only have to do that for the main page, and it affects the content pop-ups.
I hope I explained this well enough. Thank you for any advice!
It's very simple to do in jQuery:
$("#yourDivsId").load("/UrlOfYourIntendedMarkupDelivery?anyarguments=true");
I have to scrape this page using php curl. In this when the user scrolls down , more items are loaded using ajax . Can I call the URL that the ajax script is calling ? If so, then how do I figure the URL out ? I know a bit of ajax, but the code there is kind of complex for me.
Here is the relevant js code pastebin
Alternatively can someone suggest an alternative method of scraping that page? PS : I doing this for good cause.
Edit: I figured it out. Live http headers. QUestion can be closed. downvoted to oblivion.
You can use FireBug for that. Switch to the Console-Tab and then make the page make the AJAX-request.
This is what should see after scrolling to the bottom of the page: http://www.flipkart.com/computers/components/ram-20214?_l=m56QC%20tQahyMi46nTirnSA--&_r=11FxOYiYfpMxmANj4kGJzg--&_pop=flyout&response-type=json&inf-start=20
and if you scroll further: http://www.flipkart.com/computers/components/ram-20214?_l=m56QC%20tQahyMi46nTirnSA--&_r=11FxOYiYfpMxmANj4kGJzg--&_pop=flyout&response-type=json&inf-start=40
The tokens seem to always remain the same: _l=m56QC%20tQahyMi46nTirnSA-- and _r=11FxOYiYfpMxmANj4kGJzg--, so does the _pop-parameter: _pop=flyout So let's have a look at the other parameters:
This one was for the main page:
//no additional parameters...
this one for the first 'reload':
&response-type=json&inf-start=20
and this one for the second 'reload':
&response-type=json&inf-start=40
So, appearently you just have to append &response-type=json&inf-start=$offset to your initial URI to get the results in JSON-format. You can also see the contents in FireBug which should make it very easy to work with them.
Here's a screenshot:
On my site, I have google adsense in my right hand side nav bar. The problem I find is because the adsence code is placed before the actual webpage content, as I use includes in php to pull my site template in, I find that it loads the adsence code first and can cause everything else to load after it.
Does anyone know of a good way that I can force it to loads after the actual webpage loads?
Hi i managed to solve it. I found this: How to make Google Adsense load last after the rest of page and someone replied with a link to show how to do it. Solved. Thanks :)
http://www.plus2net.com/php_tutorial/sleep.php
Something like this?
Or use a javascript settimeout and display an ajax loader gif whilst it loads.
More info on AJAX preloaders: http://blog.twostepmedia.co.uk/jquery-ajax-gif-preloader/
If you can edit your site's template, then you should be able to edit the Adsense loader. Find where it is being included on your template and move it down, to just before the closing </body> tag.
How to hide an iframe url in HTML source code.I have two applications one applications get an url of another application into its iFrame,so that it displays in its source code.I dont want to display another application url in the source code.
I think you would need to set the IFRAME URL via JavaScript. The Javascript could then be Obfuscated, so that the URL would not be in plain text... Please see the following link for the obfuscator:
http://www.javascriptobfuscator.com/Default.aspx
i.e. if it was jQuery...
$("#myiFrame").attr('src','http://www.google.com');
becomes:
var _0xc1cb=["\x73\x72\x63","\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x67\x6F\x6F\x67\x6C\x65\x2E\x63\x6F\x6D","\x61\x74\x74\x72","\x23\x6D\x79\x69\x46\x72\x61\x6D\x65"];$(_0xc1cb[3])[_0xc1cb[2]](_0xc1cb[0],_0xc1cb[1]);
You can't hide it per say, but you can run it through something like TinyURL so that anyone interested would need to go an extra step. Anyway, that's the only thing I can think of. However, if you are displaying that page in a frame, what's the harm in having the URL in the source code? There really isn't a good, foolproof way to prevent someone determined from finding out the location of that iframe page.
You can create a php script which uses curl to call the url through localhost, then use this script as your iframe source.
If you have an issue with relative links and sub-directories, you can put your curl script inside the sub-directory.